How to Change MySQL Data Directory in Linux Centos

In order to enhance MySQL Performance, it’s always better to store MySQL DB files in a separate hard disk partition. In Linux CentOS, default data file is store in /var/lib/mysql, you can change the data store in /etc/my.cnf file.

Change the line below to your database directory


After that restart mysql service

# /etc/init.d/mysqld restart