搜索
首页数据库mysql教程[MySQL] ERROR 2002(HY000): Can't connect to local My

1 故障描述 测试环境Cacti页面登陆失败,sa找我排查问题,sa找我看是否是DB故障 2 去db服务器check。 [root@xxxx mysqldata]# ps-eaf|grep mysql root1422 12582 0 03:48 pts/13 00:00:00 grep mysql root1961 1 0 Sep02 ? 00:00:03 /bin/sh /usr/bin/mysqld_s

1 故障描述

测试环境Cacti页面登陆失败,sa找我排查问题,sa找我看是否是DB故障

 

2 去db服务器check。

[root@xxxx mysqldata]# ps-eaf|grep mysql

root     1422 12582  0 03:48 pts/13   00:00:00 grep mysql

root     1961     1  0 Sep02 ?        00:00:03 /bin/sh /usr/bin/mysqld_safe--datadir=/opt/mysqldata --socket=/var/lib/mysql/mysql.sock--pid-file=/opt/mysqldata/mysqld.pid --basedir=/usr --user=mysql

mysql   15117  1961  3 03:44 ?        00:00:08 /usr/libexec/mysqld--basedir=/usr --datadir=/opt/mysqldata --user=mysql--log-error=/opt/mysqldata/mysqld.log --pid-file=/opt/mysqldata/mysqld.pid--socket=/var/lib/mysql/mysql.sock

root    31480  6972  0 Sep17 pts/8    00:00:00 mysql -uroot -px xxxxxxx

[root@xxxx  mysqldata]#

OK,mysql进程一切正常,在后台运行着,没有被kill掉。

 

3 用root登陆check里面的mysql线程

[root@xxxx mysqldata]# mysql-uroot -p

Enter password:

ERROR 2002 (HY000): Can't connect to localMySQL server through socket '/var/lib/mysql/mysql.sock' (111)

[root@eanltrsutl001 mysqldata]#

 

4  去查看mysql的error日志

在2的步骤里面已经看到了--log-error=/opt/mysqldata/mysqld.log参数,所以去打开error日志文件/opt/mysqldata/mysqld.log

[root@xxxx mysqldata]# tail –f /opt/mysqldata/mysqld.log

130930 3:39:50  InnoDB: Started; logsequence number 3 3403486393

130930 3:39:50 [ERROR] /usr/libexec/mysqld: Error writing file'/opt/mysqldata/mysqld.pid' (Errcode: 28)

130930 3:39:50 [ERROR] Can't start server: can't create PID file: No space lefton device

130930 03:39:50 mysqld_safe Number ofprocesses running now: 0

130930 03:39:50 mysqld_safe mysqldrestarted

130930 3:39:50  InnoDB: Initializingbuffer pool, size = 15.0G

130930 3:39:51  InnoDB: Completedinitialization of buffer pool

InnoDB: The log sequence number in ibdatafiles does not match

InnoDB: the log sequence number in theib_logfiles!

130930 3:39:51  InnoDB: Database was notshut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information fromthe .ibd files...

InnoDB: Restoring possible half-writtendata pages from the doublewrite

InnoDB: buffer...

130930 3:39:51  InnoDB: Started; logsequence number 3 3403486393

130930  3:39:51 [ERROR] /usr/libexec/mysqld: Errorwriting file '/opt/mysqldata/mysqld.pid' (Errcode: 28)

130930  3:39:51 [ERROR] Can't start server: can'tcreate PID file: No space left on device

130930 03:39:51 mysqld_safe Number ofprocesses running now: 0

130930 03:39:51 mysqld_safe mysqldrestarted

130930 3:39:51  InnoDB: Initializingbuffer pool, size = 15.0G

看到了有没有,No space left ondevice,肯定是磁盘满了,导致无法wrote了。

 

5 去check磁盘空间

[root@xxxx mysqldata]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/Sys-root 1008M  513M 445M  54% /

tmpfs                  15G    0   15G   0% /dev/shm

/dev/mapper/Sys-applog

                       50G   14G  34G  29% /applog

/dev/vda1             194M   33M 152M  18% /boot

/dev/mapper/Sys-home  2.0G  68M  1.9G   4% /home

/dev/mapper/Sys-opt    20G  19G     0  100%/opt

/dev/mapper/Sys-tmp   7.9G 3.4G  4.2G  45% /tmp

/dev/mapper/Sys-usr   2.0G 1.9G   41M  98% /usr

/dev/mapper/Sys-var   7.9G 4.4G  3.2G  58% /var

/dev/mapper/Sys-crash

                      2.0G   68M 1.9G   4% /var/crash

/dev/mapper/Sys-log   7.9G 1.3G  6.3G  17% /var/log

/dev/mapper/Sys-vtmp 1008M   34M 924M   4% /var/tmp

//10.15.41.252/share  466G  23G  444G   5% /applog/winshare

果然是磁盘满了,/opt目录都100%了,赶紧通知sa清理磁盘空间,sa将磁盘扩充到了40G

 

6 root登陆check mysql db状态

[root@xxxx mysqldata]# mysql-uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: NO)
[root@xxxx mysqldata]#


PSOK,好了,磁盘满了之后,只要加大磁盘空间,mysql会自动恢复各种clients连接操作的。

 

 

7 善后

    由于这台是测试服务器的cacti监控应用db服务器,所以部署安装完db后,提醒sa添加磁盘监控,但是dev部门说没事量不大,sa忙碌别的事情就没有来得及加磁盘监控。

     看来还得及时提醒sa去添加磁盘监控,dev的经验也不是100%靠谱啊!

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
在MySQL中使用视图的局限性是什么?在MySQL中使用视图的局限性是什么?May 14, 2025 am 12:10 AM

mysqlviewshavelimitations:1)他们不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinSorsubqueries.2)他们canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

确保您的MySQL数据库:添加用户并授予特权确保您的MySQL数据库:添加用户并授予特权May 14, 2025 am 12:09 AM

porthusermanagementInmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

哪些因素会影响我可以在MySQL中使用的触发器数量?哪些因素会影响我可以在MySQL中使用的触发器数量?May 14, 2025 am 12:08 AM

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)复杂的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

mysql:存储斑点安全吗?mysql:存储斑点安全吗?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

mySQL:通过PHP Web界面添加用户mySQL:通过PHP Web界面添加用户May 14, 2025 am 12:04 AM

通过PHP网页界面添加MySQL用户可以使用MySQLi扩展。步骤如下:1.连接MySQL数据库,使用MySQLi扩展。2.创建用户,使用CREATEUSER语句,并使用PASSWORD()函数加密密码。3.防止SQL注入,使用mysqli_real_escape_string()函数处理用户输入。4.为新用户分配权限,使用GRANT语句。

mysql:blob和其他无-SQL存储,有什么区别?mysql:blob和其他无-SQL存储,有什么区别?May 13, 2025 am 12:14 AM

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而alenosqloptionslikemongodb,redis和calablesolutionsoluntionsoluntionsoluntionsolundortionsolunsolunsstructureddata.blobobobsimplobissimplobisslowderperformandperformanceperformancewithlararengelitiate;

mySQL添加用户:语法,选项和安全性最佳实践mySQL添加用户:语法,选项和安全性最佳实践May 13, 2025 am 12:12 AM

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

MySQL:如何避免字符串数据类型常见错误?MySQL:如何避免字符串数据类型常见错误?May 13, 2025 am 12:09 AM

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollat​​ionsEttingsefectery.1)usecharforfixed lengengters lengengtings,varchar forbariaible lengength,varchariable length,andtext/blobforlabforlargerdata.2 seterters seterters seterters seterters

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

mPDF

mPDF

mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

螳螂BT

螳螂BT

Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境