简体   繁体   English

数字海洋,使用mySQL工作台连接数据库

[英]Digital Ocean, connect to database with mySQL workbench

I just started digital ocean server running ubuntu 14.04 LAMP server. 我刚开始运行ubuntu 14.04 LAMP服务器的数字海洋服务器。 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. 我使用了我的drop IP地址,root作为用户和端口3306.我输入了正确的密码,但我不能为我的生活连接我的服务器上的SQL。 ANy suggestions? 有什么建议?

Error in mySQL Workbench: 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 https://www.digitalocean.com/community/questions/how-to-create-a-secure-connection-for-workbench-to-mysql

MySQL Workbench works without any configuration necessary. MySQL Workbench无需任何配置即可运行。 When making a new connection, select "Standard TCP/IP over SSH", then change the SSH and MySQL parameters as necessary. 进行新连接时,选择“基于SSH的标准TCP / IP”,然后根据需要更改SSH和MySQL参数。 (You should probably keep the SQL server IP address as 127.0.0.1.) (您应该将SQL Server IP地址保留为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 确保root用户是否允许从Localhost,127.0.0.1或:: 1(localhost)外部进行连接,如果不允许,请为localhost之外的连接创建root用户

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: @'%'表示现在您可以从任何站点连接,或者您想要指定连接的IP地址,如:

.... '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. 在某些设置中,默认情况下,root帐户通常仅允许由127.0.0.7使用。 (Check @Jhonny Montoya answer for that. (检查@Jhonny Montoya的答案。
  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. 一些托管公司认为整个服务器或3306端口只允许在本地使用,允许在远程表中使用您的IP地址。

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. 请记住,家庭用户很可能在每次路由器重启时都更改IP,因此在发生这种情况时您需要重新添加自己。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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