Set disk quotas for Linux MySQL databases

  
                  

Because the MySQL database itself does not have the disk quota feature, we can limit the quota tool that comes with Linux for mysql disk quota.

1, first need to automatically mount a partition for /home, and set to quota disk format. Let's take the user foo as an example and set the disk quota of foo. Please refer to the Linux Quota Basic Tutorial for details on how to set it up.

2, create a dbs directory to store the database in the foo home directory, and set the ownership of this directory to mysql:foo, the permissions are 3755.

mkdir /home/foo/dbs

chown mysql:foo /home/foo/dbs

chmod 3755 /home/foo/dbs

3 Now move all foo database files in /var/lib/mysql to the /home/foo/dbs directory.

mkdir /root/backup

cp -avr /var/lib/mysql/* root/backup

mv /var/lib/mysql/database-name /home /foo/dbs/

chown -Rf mysql:foo /home/foo

chmod -Rf 3755 /home/foo

ln -s /var/lib/mysql /database-name /home/foo/dbs/database-name -v

Restart the mysql database server:

etc/init.d/mysqld restart

Copyright © Windows knowledge All Rights Reserved