Home >Operation and Maintenance >Linux Operation and Maintenance >What to do if mysql in linux has 10061 error
Solution: 1. Log in to the mysql command line as the root user, and use the "vi /etc/mysql/mysql.conf.d/mysqld.cnf" command to change the "bind-address" field content to " 0.0.0.0"; 2. Use "grant all on *.* to account@'%' identified by 'password' with grant option" to authorize the specified IP address and restart mysql.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Mysql 10060 error is usually caused by the firewall
ufw allow 3306; //允许外部访问3306端口 ufw allow from 192.168.1.115; //允许此IP访问所有的本机端口 ufw status; //查看防火墙状态 ufw disable/enable; //关闭或打开防火墙
You can just perform the installation without installing ufw: apt-get install ufw;
mysql 10061 error is caused by configuration
Solution
First step:
Check mysql first Running status
netstat -ntlp | grep -v tcp6; //查看端口状态 mysql -V; //查看mysql版本号 find / -name mysqld.cnf; // 查找mysqld.cnf 的位置
If the port is 127.0.0.1:3306, solution
vi /etc/mysql/mysql.conf.d/mysqld.cnf; //将bind-address = 127.0.0.1 修改成 bind-address = 0.0.0.0
service mysql restart; //重启mysql netstat -ntlp | grep -v tcp6; //查看端口状态为0.0.0.0:3306即可
Step 2:
grant all on *.* to Replace here with the account you want to log in@'%' identified by 'Replace here with the password of the account' with grant option;
The example is as follows:
Recommended learning: Linux video tutorial
The above is the detailed content of What to do if mysql in linux has 10061 error. For more information, please follow other related articles on the PHP Chinese website!