# Recommended: "Linux mysql2003 error solution: first enter the mysql directory; then open the my.cnf file, find "bind-address = 127.0.0.1", and add the "#" symbol in front; finally add "kip -external..." code is enough.
mysql video tutorial》
Not much to say, just go to the code
1. Enter in the console and enter the mysql directory,
sudo su //进入root权限cd /etc/mysql
2. Open my. cnf file, find bind-address = 127.0.0.1 and comment it out with # in front, as follows: #bind-address = 127.0.0.1
3. Then add the following code; OK .
skip-external-lockingskip-name-resolveIf #bind-address = 127.0.0.1 is not found in the my.cnf file, as shown in the figure:
Then enter the second path /etc Open the mysqld.cnf file in the /mysql/mysql.conf.d/ folder and modify it.
4. Restart the mysql service
service mysql restartBy the way, let me tell you how to solve the is not allowed to connect to this MySQL server error when connecting;1. Enter mysql -uroot -p password on the console to enter mysql (2. Enter use mysql; to enter the mysql database
3. Enter update user set host='%' where user=' root' ; to allow access through IP.) Note: The method in brackets allows everyone to connect, which is easy to be hacked by others, so you need to set up designated IP access. The specific method is as follows:
Directly enter:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'要指定的IP地址' IDENTIFIED BY '设置的密码' WITH GRANT OPTION;You can also update the host to % first, and then update the host to your own IP through the graphical interface (SqlYog, workbench, etc.).
4. Continue to enter flush privileges; Remember, no matter which method you choose above, you must perform this step to update the database user permissions. Very important! ! !
5. Then reconnect and the problem will be solved.
The above is the detailed content of How to solve linux mysql2003 error. For more information, please follow other related articles on the PHP Chinese website!