文 - 篇  访客 -

mySQL 错误日志分析


  分类:Mysql  / 
更新:2023-08-14 09:49:21  /  创建:2023-08-04 16:06:58
不要删除

date created: 2022-07-05 11:13

mysqlbinlog查询日志方式

mysqlbinlog  --start-datetime='2019-09-27 12:50:31' --stop-datetime='2019-09-27 15:37:31'  ./mysql-bin.000065    > /tmp/mysql_restore.sql

vi /tmp/mysql_restore.sql

rm -rf /tmp/mysql_restore.sql

按日期查询  写入文件 ,vi查看   /查找  n向下查找,N向上查找    ,完成后删除文件


mysqlbinlog  --start-datetime='2018-05-16 5:50:31' --stop-datetime='2018-05-19 16:01:31'  ./mysql-bin.000027    > ./mysql_restore.sql



# hostname   //获得主机名

<hostname>

#find / -name <hostname>.err

.....

#cd ...

#vi <hostname>.err

<https://github.com/twitter/mysql/commit/1912d02a461797977219e2578080b790020ad845>

<https://github.com/twitter/mysql/blob/master/sql/hostname.cc>

 错误:

130111  3:33:55 [Warning] IP address '74.86.110.133' has been resolved to the host name '74.86.110.133-static.reverse.softlayer.com', which resembles IPv4-address itself.

130111  4:00:00 [Note] /usr/sbin/mysqld: Normal shutdown

130111  4:00:00 [Note] Event Scheduler: Purging the queue. 0 events

130111  4:00:02 [Warning] /usr/sbin/mysqld: Forcing close of thread 410210  user: 'root'

<http://dev.mysql.com/doc/refman/5.5/en/host-cache.html> DNS 高速缓存 问题

<http://dev.mysql.com/doc/refman/5.5/en/blocked-host.html>  解决方案

SET GLOBAL max_connect_errors=10000;

错误日志有类似警告:

120119 16:26:04 [Warning] IP address '192.168.0.110' could not be resolved: Name or service not known

120119 16:26:04 [Warning] IP address '192.168.0.104' could not be resolved: Name or service not known

120119 16:26:04 [Warning] IP address '192.168.0.147' could not be resolved: Name or service not known

通过show processlist发现大量类似如下的连接:

|592|unauthenticated user|192.168.3.20:35320|NULL|Connect| |login|NULL|

|593|unauthenticated user|192.168.3.20:35321|NULL|Connect| |login|NULL|

|594|unauthenticated user|192.168.3.20:35322|NULL|Connect| |login|NULL|

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

修改配置文件添加并需要重启:

[mysqld] 

skip-name-resolve

添加后发现错误日志有

120203 10:21:06 [Warning] 'user' entry 'root@r590ubuntu' ignored in --skip-name-resolve mode.

120203 10:21:06 [Warning] 'user' entry '@r590ubuntu' ignored in --skip-name-resolve mode.

只需去服务器里边把用户root@r590ubuntu和@r590ubuntu删除即可。

错误:

:57 [Note] Flashcache bypass: disabled

130116 20:14:57 [Note] Flashcache setup error is : ioctl failed

地址: <http://bugs.mysql.com/bug.php?id=64927>

130201  3:29:07 [Warning] IP address '222.217.223.49' could not be resolved: Temporary failure in name resolution

<http://blog.csdn.net/lxpbs8851/article/details/7892256>

解决方案:

[mysqld]

--skip-host-cache

--skip-name-resolve

不要删除

是日已过,命亦随减,如少水魚,斯有何乐?