Home >Database >Mysql Tutorial >Solution to SQL Error (2013) connection error in MySQL_MySQL

Solution to SQL Error (2013) connection error in MySQL_MySQL

WBOY
WBOYOriginal
2016-07-06 13:32:481204browse

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:

2016627174208140.png (706×126)

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).

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn