mysql常见问题解决方法.

1. 问题:mysql启动报错(linux)

[root@localhost ~]# service mysqld restart

Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]

解决方法:

[root@localhost ~] mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

[root@localhost ~]# service mysqld restart

2. 问题:navicat连接mysql:报1130错误(windons)

1130: Host xxx.xxx.xxx.xxx  is not allowedto connect to this MySQL server  

解决方法:

mysql>use mysql
mysql>update user set host = '%'  where user ='root';
mysql>flush privileges;
mysql>select 'host','user' from user where user='root';
mysql>quit

3. 问题: navicat连接mysql:报1045错误

1045  Access denied for user 'root'@'localhost' (using password:YES) 

解决方法:

/etc/init.d/mysqld stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('123456') where USER='root';

(UPDATE user SET Password=PASSWORD('123456') where USER='root' and host='root' or host='localhost';)

mysql> FLUSH PRIVILEGES;
mysql> quit

 /etc/init.d/mysqld restart

4. 问题: navicat连接mysql:报10060错误

Can't connect to MySQL server (10060)

解决方法:

http://database.51cto.com/art/201107/274565.htm重点检查3306端口是否已经开放

5. 问题:如何创建其他账号远程连接mysql服务器

mysql>use mysql
mysql>GRANT ALL PRIVILEGES ON *.* TO 'sems_mysql'@'%' IDENTIFIED BY 'gziscassems' WITH GRANT OPTION;  

6. 问题: navicat连接mysql:报10061错误

2003- can.t connect to MySQL server on xxx.xxx.xxx.xxx (10061)

解决方法:

启动mysql服务

[root@centos64 ~]# service mysqld start

问题:navicat连接mysql:报ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

/etc/init.d/mysqld stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql

mysql> delete from user where USER='';
mysql> FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
mysql> quit

原文地址:https://www.cnblogs.com/hjhsysu/p/5776624.html