简体   繁体   中英

Digital Ocean, connect to database with mySQL workbench

I just started digital ocean server running ubuntu 14.04 LAMP server. I used my droplets IP address, root as the user and port 3306. I typed in the right password, but I can not for the life of me connect to my SQL on my server. ANy suggestions?

Error in mySQL Workbench:

Your connection attempt failed for user 'root' from your host to server at myIP:3306:
  Can't connect to MySQL server on 'myIP' (61)

I was able to find this answer here:

https://www.digitalocean.com/community/questions/how-to-create-a-secure-connection-for-workbench-to-mysql

MySQL Workbench works without any configuration necessary. When making a new connection, select "Standard TCP/IP over SSH", then change the SSH and MySQL parameters as necessary. (You should probably keep the SQL server IP address as 127.0.0.1.)

Be sure if the root user is allow to connect from outside of Localhost, 127.0.0.1 or ::1 (which is localhost), if not, create the root user for connections outside localhost

CREATE USER 'root'@'%' IDENTIFIED BY 'YourPassWord';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'YourPassWord' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

the @'%' means that now you can connect from any site, or maybe you want to specify a IP address from which connect like:

.... 'root'@'yourIpAddress' .....

Considering the error the problem is in your connection not in your authentication.

Some things you should check first:

  1. Root accounts usually are only allowed to be used by 127.0.0.7 by default in some setups. (Check @Jhonny Montoya answer for that.
  2. Some hosting companies make it that the whole server or the 3306 port is only allowed to be used locally, allow your IP address in the remote table.

And remember that home users are very likely to have their IP changed every time their router restart so you need to re-add yourself when this happens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM