Changing MySQL Default Data directory in Percona XtraDB Cluster.


We have setup a 3 node Percona MySQL XtraDB Cluster 5.7 under Azure Load Balancer. But, when we deployed, we did not change MySQL data directory. Now, our DB size is increasing day by day. Hence, we have attached a Premium SSD. Now, we want to change default MySQL data directory on all 3 nodes.

Can anyone please drop me step by step procedure to change MySQL data directory on all 3 nodes of Cluster???

Awaiting for your kind response.

Azure LB? Why would you do that for? But yeah… anything’s possible.

Not quite a big fan to change data-dir but usually I symlink everything.

The way I do it (CentOS 7 let’s say):

# systemctl stop mysql
# mv /var/lib/mysql /mnt/mysql-data
# ln -s /mnt/mysql-data/mysql mysql
# chown -R mysql:mysql /mnt/mysql-data/

Last line is more to make sure that all permissions are in place.

Once that’s completed:

#systemctl start mysql

Job done, nothing else changed.

Never had an issue using this in years.

Thanks dude for taking initiative & responding to this thread. I have successfully changed the data directory of MySQL in Percona Cluster. Job done. I have moved it to another Azure premium SSD attached to my cluster nodes.