MySQL cannot connect remotely

Source: Internet
Author: User

Do not want to waste time, I this article recorded my vagrant on the shelves of MySQL remote connection is not the problem, but I found this link in the collation, if I can find this in the beginning I will not go around so many bends. Don't want to see how I step the wrong course of the process please look directly at the address below, I also copied the content under the address. Your own debugging process a bit long, when the record bar, interested can look under, maybe to you helpful http://www.jb51.net/article/33813.htmvim/etc/my.cnf comment this line: bind-address=127.0.0.1 ==> #bind-address=127.0.0.1
Save exit.
mysql-uroot-p123456

To grant permissions to users who require remote logins:

Copy CodeThe code is as follows:
Mysql> GRANT All privileges on * * to [e-mail protected] "%" identified by "123456";
mysql> flush Privileges;

Telnet command: Mysql-h 223.4.92.130-uroot-p (-H followed by the IP address of the host to be logged in) My implementation of the debugging process to understand the above to solve the problem can be the following do not see. My actual situation describes the use of third-party software to log on to the database on the server MYSQ, the third software for the NAVICAT environment: Mac OS 10.11.5 vagrant CENTOS7 Box is Germany (language to find it should not affect very much) LNMP one-click Install version Reason: to the number According to the structure of the library synchronization to another database implementation method with Navicat this software (data structure synchronization self-search) problem: Installed and cracked navicat has been unable to log on the MySQL prompt can not be remote connection (Mac hack over the process of their own search) Error tip: First my destination IP address The 192.168.10.10 (local test server) was installed using the vagrant, and the centos7 was mounted. Navicat connection Information so fill out the hint is not connected, 192.168.10.10 can not connect? I tried again the SSH connection to get the hint is 192.168.10.10 this MySQL does not have remote connection permissions. (PS: My mac environment used sequel Pro.app SSH connection is no problem at that time 3306 Port I did not open it) is not CENTOS7 port is not open it? sudo firewall-cmd --query-port=3306/tcp  //永久开放3306端口sudo firewall-cmd-reload//restart firewall  Re-use the Navicat SSH connection method Attempt, the result is the same as the above hint, the connection fails 192.168.10.10 not allow remote connection directly with the Navicat regular connection test (regular means directly with the MySQL IP account password login) prompt changed   The prompt is changed when the port is opened. Looks like it's going to have to be solved.   Previous prompt to 192.168.10.10 no remote connection permission is not the MySQL account does not allow remote connection? Baidu Google has the next MySQL remote connection. General methods (find it yourself) 1. Modify MySQL database within the user table, under the root account, the host changes to%  Most of the online teaching to use the command line to modify (PS: direct phpMyAdmin repair not just good?) Why do you have to use the command line to modify, later only to know, but still be a pit of a back said) #mysql-uroot-p fill in the password use mysqlupdate user set host = '% ' where user = ' root '; Error 1062 (23000): Duplicate entry '%-root ' for key ' PRIMARY '  //Is this an error? Select Host, user from user; View Data Sheet   Error But the change was a success.   Once again try to do a regular connection with navicat The result is another SSH result is   The second method: Authorization method grant all privileges on * * to ' username ' @ '% ' identified by ' user password ' with GRANT OPTION;    //Add an account, any IP can connect this to a mysqlgrant all privileges on * * to ' root ' @ ' 192.168.10.10 ' identified by ' MyPassword ' W ITH GRANT OPTION; Set the root user can fill out the IP address by 192.168.10.10 it, I will fill out the method of IP address. or failure.   Third method: Modify the MY.CNF will be opened remotely  //mysql 5.0 version of the difference between the general web-based modification is 5.0 after the modification method. Note this line: bind-address=127.0.0.1 ==> #bind-address=127.0.0.1//5.0 version before the bind-address can not find the comment out #skip-networking  //I was originally annotated.   Because the general connection times is 192.168.10.1 this Vagrant Bridge Gateway Bar (PS: I understand that the wrong people point out), there is no remote connection to MySQL permissions? With Telnet 192.168.10.10 3306 is also 192.168.10.1 do not have MySQL remote connection permissions error   Why is 192.168.10.1   because vagrant environment is a problem? It's always been like this. Later it is a variety of tests, but has not been. Finally see Baidu experience in an article, the article on the MySQL is on the windowns, but also to modify the IP address allowed methods. Dead Horse when live horse medicine, do once, at that time root of host changed to%, I thought is 192.168.10.1 this really do not have permission remote? So add a 192.168.10.1 this IP up  , the different place is the following commandflush Privileges; Reload permissions for modified permissions to take effectReload permissions .... For a lot of articles are not added to reload permissions this one, I restarted the Linux MySQL also did not give me reload permissions (did not try to restart MySQL, interested can try it yourself)sister's engaged in a big circle is because the modification of permissions do not reload, we do not know how to do inside the MySQL operation. Then, you want to summarize the question to write this article, to reproduce the problem once to do the test, the root Allow 192.168.10.1 This delete attempt, navicat or can connect, and then remove any IP can access the setting or can use the Navicat regular connection, then it is going crazy, why? Finally, the root host% is changed back to localhost flush privileges; (PS: Be sure to reset the configured permissions) the problem finally reappeared. Finally spit the trough a bit Baidu Firewall-cmd closed Port method, out of the result is not the beginning of the mouth is directly firewall this firewall off, go to google with the same keyword a check the first is the result I want to find sudo firewall-cmd--permanent--remove-port=3306/tcp//Close Centos7 3306 This port of course don't forget to restart the firewall in effect Oh sudo firewall-cmd--reload

MySQL cannot connect remotely

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.