connect mysql remotely

1. Start the mysql server


2.sqlyong connection



problem causes:

Some problems may be caused by the following reasons:

1. The network is blocked;

2. The service is not started;

3. The firewall port is not open;

Solution:

Start the service:



After analysis, the problem I encountered was caused by the firewall! Open firewall ports
to add ports that need to be monitored
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

Save settings
/etc/init.d/iptables save

View status
/etc/init.d/iptables status

Temporarily close the firewall service
service iptables stop

start firewall service
service iptables start

start no longer start firewall service
chkconfig iptables off

Note:
This document is applicable to the server environment: CentOS 6.5 MySQL 5.6

3. Reconnect


Let’s talk about this error first. In fact, our MySQL does not allow remote login, so the remote login failed. The solution is as follows:

  1. Log in to MySQL on the machine where MySQL is installed mysql -u root -p password
  2. implementuse mysql;
  3. After executing update user set host = '%' where user = 'root';this sentence, an error may be reported, ignore it.
  4. implementFLUSH PRIVILEGES;

    After the above 4 steps, you can solve this problem.
    Note: The fourth step is to refresh the MySQL permission-related table. Don't forget, I didn't perform the fourth step the first time, and the result was always unsuccessful, and finally I found the reason.

4. Reconnect



Remote connection succeeded!


Please master a lot of exhibitions!




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324715813&siteId=291194637