mysql-came-issues

今天突然碰见mysql服务挂掉的问题,就记录一下

先是重启
mysql service restart
/etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!

这时候发现是硬盘存储空间不够了

1
df -lh

发现/dev/xvda1 下可使用的几乎没有了

但是并不知道如何把大文件找到,如下

1
2
3
find path -type f -size +100M (大于100M的文件)
find path -type f -size 100M (等于100M的文件)
find path -type f -size -100M (小100M的文件)

也可以把所有比较大的目录都会列出来

1
du -sh *

然后开删

1
rm -rf

但是发现即使把这些删除了,硬盘的内存好像没有变化,最后google后用到了这个(PS:执行完后果然立马内存释放了)

1
sudo apt-get clean

然后就是接着启动

1
mysql service restart

但是奇怪的是一直在starting 但是并没有日志,后来用

1
2
3
mysqld --console

151114 23:49:56 [ERROR] Found 8 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.

最后google后找到一个办法

1
mysqld --tc-heuristic-recover=ROLLBACK

最后看了一下控制台,也可以用service mysql status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mysqld --console
151114 23:55:58 InnoDB: The InnoDB memory heap is disabled
151114 23:55:58 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151114 23:55:58 InnoDB: Compressed tables use zlib 1.2.3.4
151114 23:55:58 InnoDB: Using Linux native AIO
151114 23:55:58 InnoDB: Initializing buffer pool, size = 256.0M
151114 23:55:58 InnoDB: Completed initialization of buffer pool
151114 23:55:58 InnoDB: highest supported file format is Barracuda.
151114 23:55:59 InnoDB: Waiting for the background threads to start
151114 23:56:00 Percona XtraDB (http://www.percona.com) 5.5.41-MariaDB-37.0 started; log sequence number 2610000435

151114 23:56:00 [Note] Plugin 'FEEDBACK' is disabled.
151114 23:56:00 [Note] Server socket created on IP: '0.0.0.0'.
151114 23:56:00 [Note] Event Scheduler: Loaded 1 event
151114 23:56:00 [Note] mysqld: ready for connections.
Version: '5.5.42-MariaDB-1~precise-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution

希望可以帮到你,Best wishes