0
点赞
收藏
分享

微信扫一扫

mysql数据库突然连接失败,启动不了的解决思路,可能是磁盘满了,需要删掉日志后重启才能自动恢复

mysql数据库突然连接失败,启动不了的解决思路,可能是磁盘满了,需要删掉日志后重启才能自动恢复 错误号码2013 Lost connection to MySQL server at handshake: reading inital communication packet system error:2 用df命令查了下,果然磁盘满了,达到100%了,用du -hs 命令查询并删除一些大的日志文件: 删除了些没用的日志后,重新启动数据库还是出错,用df命令查询占用空间还是100%,需要reboot重启服务器才行。

mysql数据库突然连接失败,启动不了的解决思路,可能是磁盘满了,需要删掉日志后重启才能自动恢复

错误号码2013

Lost connection to MySQL server at handshake: reading inital communication packet system error:2

# chkconfig --list

mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

# service mysql restart

ERROR! MySQL server PID file could not be found!

Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/var/host.localdomain.pid).

[root@host ~]#

用df命令查了下,果然磁盘满了,达到100%了,用du -hs 命令查询并删除一些大的日志文件:

[root@host ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 20172432 19129592 0 100% /

/dev/sda1 388480 237095 130905 65% /boot

[root@host home]# du -hs /home/

3.8G /home/

[root@host home]# du -hs /home/wwwlogs/

3.5G /home/wwwlogs/

[root@host home]# cd wwwlogs/

[root@host wwwlogs]# ls -lh

-rw-r--r-- 1 root root 2.5G May 20 18:28 hnssc.xxx.com.log

-rw-r--r-- 1 root root 1.1G May 20 18:29 www.xxx.com.log

[root@host wwwlogs]# rm hnssc.xxx.com.log

rm: remove regular file ‘hnssc.xxx.com.log’? y

[root@host wwwlogs]# rm www.xxx.com.log

rm: remove regular file ‘www.xxx.com.log’? y

[root@host wwwlogs]#

删除了些没用的日志后,重新启动数据库还是出错,用df命令查询占用空间还是100%,需要reboot重启服务器才行。

[root@host ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 20172432 14442448 4685616 76% /

/dev/sda1 388480 237095 130905 65% /boot

tmpfs 103068 0 103068 0% /run/user/0

==================

#linux下可能需要使用下面命令(注意是mysqld,后面有个d):

systemctl restart mysqld

用命令查一下mysql的安装路径信息:

ps -ef | grep mysql

#需要设置别名才能直接使用mysql命令

alias mysql=/usr/local/mysql/bin/mysql

#登录mysql

mysql -u root -p

#如果mysql -u root -p 使用不了,可以尝试下面命令:

/usr/local/mysql/bin/mysql -h localhost -u root -p

#查看数据库

mysql> show databases;

#切入到某个库查询

mysql> use mysql;

#查询某个库的表

mysql> show tables;

#查询某个表的记录

mysql> select * from slow_log limit 2;

导入sql用source命令

大自然,飘然的风,QQ群: python技术交流群:453879716,人工智能深度学习群:251088643

golang技术交流群:316397059,vuejs技术交流群:458915921 囤币一族:621258209,有兴趣的可以加入

微信公众号:大自然预测(ssqyuce)原双色球预测, 心禅道(xinchandao)投资论道




举报

相关推荐

0 条评论