当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql碰到的问题总结

mysql碰到的问题总结

2019年01月29日  | 移动技术网IT编程  | 我要评论

1.问题描述:

连接数据库出现大约10s延迟后才能连接,排除网络问题

 

解决方案:

通过抓包工具tcpdump抓包分析mysql在连接开始有近10s的空白请求,问题原因就在这 ,不知道在执行什么请求,后面发现没有加入参数skip-name-resolve引起的。

查看mysql参数skip-name-resolve

show variables like '%skip_name_resolve%';

加入参数skip-name-resolve

参数优化:

skip-name-resolve参数的目的是不再进行反解析(ip不反解成域名),这样可以加快数据库的反应时间。

内部有dns服务器,对各服务器的ip做了反向解析,但未对内网ip做反向解析,所以使用skip-name-resolve以后用内网地址向mysqlslap请求响应快了一半。

vim /etc/my.cnf

重启mysql, 问题解决

 

2.mysql数据库批量更新错误 安全模式问题

1.问题描述:

数据库执行批量更新sql报错安全问题,

error code: 1175. you are using safe update mode and you tried to update a table without a where that uses a key column to disable safe mode, toggle the option in preferences -> sql queries and reconnect.

解决方案:

在safe mode下,要强制安全点,update必须跟where,要取消这个限制运行如下代码即可

set sql_safe_updates = 0;

 

后续更新。。。。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网