Home >Database >Mysql Tutorial >Solution to SQL Error (2013) connection error in MySQL_MySQL
Phenomena description
Today I used heidisql to log in to the MySQL of the virtual machine, but I couldn’t log in. After waiting for about a minute or two, an error message appears: SQL Error (2013): Lost connection to MySQL server at 'waiting for initial communication packet', system error: 0
, as shown in the picture below:
At first I thought it was a remote TCP/IP. Root can only be accessed through localhost. Later, I created a new user and changed it to %, but still to no avail. The problem disappeared after trying to modify the my.ini configuration problem.
Solution
In my.ini or my.cnf
In the [mysqld] item, add
skip-name-resolve
While solving this problem, another startup parameter was discovered:
skip-grant-tables
mysql startup parameters:
skip-grant-tables
As the name suggests, grant-tables, the authorization table, is not started when starting mysql. What is the use? Of course, it is useful when you forget the administrator password or there is a problem with the user table in the mysql database. Using this parameter, any account can log in to the mysql database with any password (including empty, of course).