【搬运】MySQL常见问题及解决(ing)
2016-07-16 21:31
495 查看
官方错误代码字典
以下是平时遇到就增加一条(大部分来自搜索,不再一一列举来源,感谢各位大神的经验分享,解救吾等小白于水火 Orz)
_ 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,按下面步骤解决。
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 关键词
以下是平时遇到就增加一条(大部分来自搜索,不再一一列举来源,感谢各位大神的经验分享,解救吾等小白于水火 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 关键词
相关文章推荐
- mysql 5.7.12 新增 X plugin 详解
- 说说MySQL中的事务
- 几个常见的MySQL语法
- MySql简单入门二——数据库中的数据类型
- MySQL如何安装和启动
- 浅谈MySql的存储引擎(表类型)
- MySQL中的存储引擎讲解(InnoDB,MyISAM,Memory等各存储引擎对比)
- 带你从零了解mysql
- MySql简单入门一
- MySQL基于gtid特性与xtrabackup的数据恢复
- MySQL数据库迁移详细步骤
- mySQL的 插入 查询 更新
- MySQL5.7 触发器
- MySQL索引分析
- MySql 64位 windows下环境配置
- Ubuntu下MySQL的安装及配置
- 从无到有——简单的个人博客(一)
- win10 64位安装mysql-5.7.13-winx64
- excel数据导入mysql
- mysql查询更新时的锁表机制分析(只介绍了MYISAM)