![linux centos 7 install mysql client linux centos 7 install mysql client](https://www.tecmint.com/wp-content/uploads/2017/02/Secure-MySQL-in-CentOS-7.png)
![linux centos 7 install mysql client linux centos 7 install mysql client](https://computingforgeeks.com/wp-content/uploads/2020/09/How-to-install-mysql-5.7-on-ubuntu-20.04-1024x150.png)
To make sure that the new data directory is indeed in use, start the MySQL monitor. Now restart the MySQL service after updated its configuration to use the new location. Socket=/mnt/volume-nyc1-01/mysql/mysql.sock Insert the following settings at the bottom of the file so it won’t split up directives in the block. # vim /etc/my.cnfĪfter updating the existing lines, we’ll need to add configuration for the mysql client. Now edit this file to reflect the new data directory as shown below. Step #2: Pointing to the New Data Locationīy default MySQL data directory set to /var/lib/mysql in the /etc/my.cnf file. By re-naming it, we’ll avoid confusion that could arise from files in both the new and the old location. bak extension and keep it until we’ve confirmed the move was successful. Once the rsync is complete, rename the current folder with a. When there’s a trailing slash, rsync will dump the contents of the directory into the mount point instead of transferring it into a containing mysql directory. Make sure there is no trailing slash on the directory, which may be added if you use tab completion. Now MySQL service is shut down lets start copy the existing data directory to new location with rsync command using with – a option to preserves the permissions and other directory properties while-v provides verbose output so you can follow the progress. Jun 17 11:24:20 centos-512mb-nyc1-01 systemd: Stopped MySQL Community Server. Systemctl doesn’t display the outcome of all service management commands, so if you want to be sure you’ve succeeded, use the following command: # systemctl status mysqld Once you’ve confirmed this, type exit and press “ ENTER” to leave the monitor: mysql> exitīefore changing the data directory you will need to shut down MySQL service. In the above output in can see the MySQL default data direcror /var/lib/mysql/. Step #1: Move MySQL Data Directoryīefore moving MySQL’s data directory lets see the current location using mysql command line as shown below. In this tutorial I will show you how you can change or move your data directory to new location on CentOS 7. Alternatively, you may wish to move your database to a separate location because you want to configure some sort of snapshotting technique, such as with ZFS or LVM. Step #2: Pointing to the New Data Locationĭatabases are constantly growing and it is likely to outgrow your / partition at some point, especially these days in the age of “the cloud” where you may be limited to a small / partition, but can pay to add bulk storage, or attach more disks.