Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to move a mysql database to another mount point

I have a MySQL database, it is getting larger and larger and I want to move the whole database to another mount point, where I have enough storage. I want my current data to be transferred, and that new data get saved to the new position.

software stack: MySQL 5 running on FreeBSD 6

like image 363
farzad Avatar asked Feb 28 '23 20:02

farzad


1 Answers

Of course other answers are valid. But if you want to keep the default configuration, do following:

  1. stop mysqld
  2. mv /var/lib/mysql /var/lib/mysql.backup
  3. mount your new partition under /var/lib/mysql
  4. cp -r /var/lib/mysql.backup /var/lib/mysql
  5. start mysqld
like image 184
vartec Avatar answered Mar 05 '23 14:03

vartec