linux mysql 磁盘空间_Linux磁盘空间爆满,MySQL无法启动

OS: Cent OS 6.3

DB: 5.5.14

看到一个帖子,在服务器上安装了oracle和mysql数据库,mysql数据库忘记开启innodb_file_per_table,导致插入测试数据后磁盘空间爆满,mysql启动报错,并且无法启动。

1、可以直接删除ibdata文件后重建mysql数据库,but,里面还有一些有用数据,因此无法直接删除ibdata进行操作,只能另谋出路。

2、Linux默认会保留5%的空间,用tune2fs命令

模拟:

服务器上也有oracle和mysql数据库,用dd直接把磁盘空间撑爆

dd  if=/dev/zero   of=/export/test   bs=50MB  count=2000

[root@db01 export]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root

50G   48G     0 100% /

tmpfs                 7.7G     0  7.7G   0% /dev/shm

/dev/sda1             485M   32M  429M   7% /boot

[root@db01 ~]# service mysqld stop

Shutting down MySQL............................................ SUCCESS!

[root@db01 ~]# service mysqld start

Starting MySQL.................................................................................................................................................................................................................................................................................................................................无法正常启动

数据库忘记设置innodb_fiile_per_table,其它库中又有有用数据,无法直接删除ibdata重新配置

在Linux系统中,默认会保留5%的空间

[root@db01 log]# tune2fs -m 1 /dev/mapper/VolGroup-lv_root

tune2fs 1.41.12 (17-May-2010)

Setting reserved blocks percentage to 1% (131072 blocks)

查看磁盘空间:

[root@db01 log]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root

50G   48G  783M  99% /

tmpfs                 7.7G     0  7.7G   0% /dev/shm

/dev/sda1             485M   32M  429M   7% /boot

空间由原来的100%变成了99%,尝试启动mysql数据库

[root@db01 ~]# service mysqld start

Starting MySQL SUCCESS!

[root@db01 ~]# ps -ef | grep mysql

root     31405     1  3 00:37 pts/2    00:00:00 /bin/sh /export/servers/mysql/bin/mysqld_safe --datadir=/export/servers/mysql/data --pid-file=/export/servers/mysql/tmp/mysql.pid

mysql    32200 31405 63 00:37 pts/2    00:00:01 /export/servers/mysql/bin/mysqld --basedir=/export/servers/mysql --datadir=/export/servers/mysql/data --plugin-dir=/export/servers/mysql/lib/plugin --user=mysql --log-error=/export/servers/mysql/log/error.log --open-files-limit=65535 --pid-file=/export/servers/mysql/tmp/mysql.pid --socket=/export/servers/mysql/tmp/mysql.sock --port=3306

root     32218 27979  0 00:37 pts/2    00:00:00 grep mysql

[root@db01 bin]# ./mysql -uroot -S /export/servers/mysql/tmp/mysql.sock

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.14-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sakila             |

| test               |

| yoon               |

+--------------------+

6 rows in set (0.05 sec)

mysql>

最后通过mysqldump备份数据库,删除ibdata重新配置mysql,并设置innodb_file_per_table 为 on

tune2fs用法:

1、tune2fs --help

2、找度娘

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值