Home >Topics >Pagoda Panel >What should I do if the disk occupied by the Pagoda Panel database is too large?

What should I do if the disk occupied by the Pagoda Panel database is too large?

藏色散人
藏色散人forward
2022-01-27 17:23:214872browse

This article is provided by the tutorial column of Pagoda Panel to introduce to you how to solve the problem of the Pagoda database taking up too much disk space. I hope it will be helpful to you if you need it!

Today I checked that the server disk was almost full, so I looked for the reason. Two reasons were found;

1. There are many and large mysql-bin.000001 files;

mysql> reset master;

Run the above command to clear the log;

2. The MySQL directory ibdata1 file is too large;

1. Back up the data in the database.

mysqldump -u root -p --extended-insert --all-databases --add-drop-database --disable-keys --flush-privileges --quick --routines --triggers > /home/all-database.sql
//有的文档用的是这样的参数:
mysqldump -q -uroot -p --add-drop-table --all-databases --events >/home/all-database.sql

If ibdata1 is hundreds of GB, the backup process may take several hours.

2. Stop the MySQL service.

service mysql stop

3. Delete ibdata1, ib_logfile* and other files

mv ibdata1 ibdata1.20160419
mv ib_logfile0 ib_logfile0.20160420
mv ib_logfile1 ib_logfile1.20160420

4. Modify the my.cnf configuration file

vi /etc/mysql/my.cnf

In [mysqld ] Add the following configuration under the subkey:

innodb_file_per_table = 1

6. Restart the MySQL service

service mysql start
ps -ef|grep mysql

7. Restore data (re-import data)

mysql -u root -p
Enter password:
source /home/all-databaes.sql

The above is the detailed content of What should I do if the disk occupied by the Pagoda Panel database is too large?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete