I was restoring a 200 GB database into a newly installed RHEL machine. However, while restoring I ran into no space available
issue.
Is it possible to change the directory where the databases are stored?
I was restoring a 200 GB database into a newly installed RHEL machine. However, while restoring I ran into Is it possible to change the directory where the databases are stored? |
||||
|
First, I was able to verify that it was related to space issue only using the below
The above command returned me the output as,
As we can see from the above command, the datadir is present in
The above command basically tells the mount point of a particular directory. As I suspected, the mount point was under Stop the mysql service using,
Edit the file
References |
|||
|
Yes, you can change the location where MySQL database data resides by changing the datadir variable in the /etc/my.cnf *Make sure to backup your data prior to attempting below steps. 1.) Stop the mysqld service (service mysqld stop). 2.) Edit /etc/my.cnf and change the datadir variable to the location you would like (datadir='insert_dir_here'), and make sure to note the previous location for the next step. 3.) Move the data from the old datadir location to the new location. 4.) Start the mysqld service (service mysqld start). |
||||
|
Yes, you can change the location where a MySQL database by changing resides using a setting in the my.cnf file. |
|||||
|