Remounting MySQL Under a New Mount Point – How To

linuxmountMySQLpartition

/var/lib/mysql is mounted on partition / which is now full. Is there a way to mount this under /home/mysql for more disk space?

Best Answer

  1. Stop MySQL
  2. Move MySQL data from /var/lib/mysql to /home/mysql
  3. Point MySQL to the new data directory
  4. Start MySQL

It could be implemented like this (WARNING: not tested)

/etc/init.d/mysql stop
mv /var/lib/mysql /home/.
ln -s /home/mysql /var/lib/mysql
/etc/init.d/mysql start

Always have a backup before you start moving the data directory.

Related Topic