After restarting the MySQL database on the Linux server, various errors were found, causing the MySQL database to fail to work normally.
No matter stop, start or mysql connection, there are different error messages. The specific error messages are:
# service mysqld stop
ERROR! MySQL server PID file could not be found!
# service mysqld start
Starting MySQL.. ERROR! The server quit without updating PID file (/data/mysql/mysql.pid).
# mysql -uroot -p
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
1. Error reason:
In fact, the above three different MySQL errors are all caused by one reason: the root directory disk is full.
2. Check the large files that cause the disk to be full:
1. First, use the df command to check the disk usage:
# df
You may see in the output:
/dev/mapper/VolGroup-lv_root 39841176 37788792 28552 100% /
2. Use # du – sh * to view large files. For example, the root directory is data. Use the command to view:
# cd/data
# du – sh *
You will find that the mysql folder occupies more than n gigabytes, and then view which files:
# cd mysql
# du – sh *
You will find many large files, such as
581M mysql-bin.000029
28K mysql-bin.000030
7.6G mysql-bin.000031
4.0K mysql-bin.000032
These files are MySQL Binary Log binary files, which are mainly used for data recovery and master-slave replication of master-slave servers.
Since I have no master and slave servers, I decided to delete them.
3. Solution:
1. Delete these large files:
# rm -rf mysql-bin.000031
~~~
2. After deleting them, open my.cnf under /etc/, find
log-bin=mysql-bin
binlog_format=mixed
Comment out these two lines, that is, add the “#” sign in front:
#log-bin=mysql-bin
#binlog_format=mixed
3. Restart the MySQL server, and it is OK
service mysqld restart