The first thought was to use
1, into MySQL, create a new user root, the password is root: Format: Grant permissions on the database name. Table name to user @ Login host identified by "User password";
The code is as follows |
Copy Code |
Grant Select,update,insert,delete on *.* to root@192.168.1.12 identified by "root"; Original data table structure mysql> use MySQL; Database changed Mysql> select Host,user,password from user; +-----------+------+-------------------------------------------+ | Host | user | password | +-----------+------+-------------------------------------------+ | localhost | Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b | +-----------+------+-------------------------------------------+ |
You can see that the root user that you just created is already in the user table. The Host field indicates which hosts are logged on, their values can be IP, and host names are available.
If you are in the Linux shell command line directly to the MySQL command, can be successfully connected to MySQL, execute query statement is also more normal, but if the execution of the STOP SLAVE; The error 2013 (HY000): Lost connection to MySQL server during query problem is randomly encountered when the command occurs. If you write the operation command to the script file and then execute the script file, you will inevitably appear
Lost connection to MySQL server at ' reading initial communication packet ', System error:111
If there are any errors in remote access, it can be thought that the system has a firewall and so on, but now this strange cramp phenomenon is baffled. The last solution found is to add a startup parameter to the [MYSQLD] section inside the MY.CNF
The code is as follows |
Copy Code |
Skip-name-resolve |
Cause analysis
The so-called reverse analysis is this:
When MySQL receives the connection request, it obtains the IP of the client, in order to better match the permission record in the Mysql.user (some are defined by hostname).
If the MySQL server has a DNS server set up and the client IP does not have a corresponding hostname on DNS, the process is slow, causing the connection to wait.
After adding skip-name-resolve, I skipped a process.