Article ID: 126445, created on Aug 4, 2015, last review on Aug 4, 2015

  • Applies to:
  • Plesk 12.0 for Linux


How to change /var/lib/mysql to another directory?


  1. Create a backup of /etc/my.cnf:

    cp /etc/my.cnf{,_backup}
  2. Copy all files from /var/lib/mysql to desired directory:

    # cp -r /var/lib/mysql /data/mysql
  3. Update /etc/my.cnf by changing the location to where you have copied mysql directory:

    # vi /etc/my.cnf
  4. Restart mysqld:

    # service mysqld restart

Note: Be sure that the path to socket mysql.sock is unchanged in my.cnf and it is /var/lib/mysql. Also the directory /var/lib/mysql itself should present on the server as changing the path to the socket can cause Plesk crush.

Search Words

Change MySQL directory

How to change mysql directory to another disk

change /var/lib/mysql to another directory

29d1e90fd304f01e6420fbe60f66f838 56797cefb1efc9130f7c48a7d1db0f0c a914db3fdc7a53ddcfd1b2db8f5a1b9c 2a5151f57629129e26ff206d171fbb5f e335d9adf7edffca6a8af8039031a4c7

Email subscription for changes to this article
Save as PDF