Connecting to the database

August 18, 2013 5.2k views
Im trying to connect to the database using DB navigator in phpDesigner. I can already connect to my database with php and PDO using localhost as the host and the username and password setup through PHPmyadmin. I dont understand why that works since my database is stored on Digital Oceans VPS but it works, i can write to and from the database no problem and access my database at www.mywebsite/phpadmin normally when localhosts works it means i have LAMP installed on my local machine but i dont and when i worked previously with shared hosting for another site the host was the ip address. Anyway i didnt worry about it but now im trying to use DB navigator with PHPstorm and it needs to setup the database connection. since im using the same username and password that works for php connection to the database i assume that is correct. I have installed the driver library and selected the .com.mysql.jdbc.Driver as the driver. for URL which i assume must be host i have tried the following: pretend droplet ip = 123.456.789 jdbc:mysql://localhost:3306 jdbc:mysql://123.456.789:3306 jdbc:mysql:// jdbc:mysql:// None of these work and all say no packets recieved. Anyone know what the correct connection string is?
2 Answers
sorry should have pointed out this is with PHP storm not php designer like i initially said
Is MySQL listening on Edit /etc/mysql/my.cnf and set the listen directive to

Save the file and restart MySQL:

sudo service mysql restart

Make sure you also allow 'username'@'yourcomputersipaddress' to access MySQL:
by Etel Sverdlov
MySQL is a powerful database management system used for organizing and retrieving data. This tutorial explains how to to create new MySQL users and how to grant them the appropriate permissions.
Have another answer? Share your knowledge.