• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How To move data directory /var/lib/mysql

R

Rocket32

Guest
How do I move the mysql data directory to another the partition of the https directory or where the hosting allows me a large amount of space? My mysql data is large and causes problems. How do I move the data from /var/lib/mysql directory to another partition or create one? I am only allowed so much space in /var directory which is part of root partition. I have 400G of Disk Space and only 4 Gigs of Ram which is where the mysql data directory is located, taking up a large amount of that Ram space on each new mysql database install that has space. I would like to move the mysql data directory and/or whatever other files needed to be moved to the Server Disk Drive space I have on this account which is 400G.
 
Last edited by a moderator:
It is specified in /etc/my.cnf as

datadir=/var/lib/mysql
 
My question is can I change it in my.cnf without interfering or messing up the current local mysql databases. I am trying to put it on another partition which is not limited to space. Also, how do I put it on another partition where the sites are or the 400GB space on my server account? I just want to move it because the partition it is on only allows 4GB. My mysql databases require a lot of space which eats up this 4G on the same partition.
 
You can mount your another partition to /var/lib/mysql mount point at least. Look at common Linux mount documentation and /etc/fstab file.
 
Back
Top