您的位置:首页 > 数据库 > MySQL

【搬运】MySQL常见问题及解决(ing)

2016-07-16 21:31 495 查看
官方错误代码字典

以下是平时遇到就增加一条(大部分来自搜索,不再一一列举来源,感谢各位大神的经验分享,解救吾等小白于水火 Orz)

连接相关

ERROR 1129 (HY000)

_ Host * is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' _

原因:

同一个ip在短时间内产生太多中断的数据库连接而导致的阻塞(即超过mysql数据库max_connection_errors的最大值)

解决:

法一:刷新

mysqladmin flush-hosts -h host -u user -p

法二:修改错误最大连接数

配置文件/etc/my.cnf(不同系统可能不同),max_connection_errors=23 # 自定义

ERROR 1045 Access Denied

_ Got error: 1045: Access denied for user 'root'@'127.0.0.1' (using password: YES) when trying to connect _

密码错误,或者没给该IP给访问权限,你懂的。

ERROR 1862 密码过期

在使用mysqldump -uroot -h127.0.0.1时出现了1046错误下面的错误:

_ mysqldump: Got error: 1862: Your password has expired. To log in you must change it using a client that supports expired passwords. when trying to connect _

如果确定密码没有问题且没有设置过期,这种情况一般都是数据库设置了禁止域名解析(配置文件中skip_name_resolve)导致的,禁止域名解析后,无法将127.0.0.1转为localhost,按下面步骤解决。

mysql -h127.0.0.1 -uroot -p
set password for 'root'@'127.0.0.1'=password('your pwd here');
flush privileges;

语法问题解决

字段名使用了SQL语法预留的关键字

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key' at line 1

其实很多都是字段名使用了SQL保留关键的原因,如这里的'key',MySQL关键字检索:MySQL 5.7 关键词
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: