Moving data directory to another location

Recently i installed fresh copy of Percona MySql 5.6 on server. I created my.cnf with following parameters but when i start “/etc/init.d/mysql start” i got “Starting MySQL (Percona Server). ERROR! The server quit without updating PID file (/home/databases/server.pid).” error.

Note: It works properly when i move /etc/my.cnf to another location.

[mysqld]
datadir=/home/databases
socket=/var/lib/mysql/mysql.sock
user=mysql

Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

thread-cache-size=50
join-buffer-size=4M
max_allowed_packet=64M
table-cache=1024
tmp-table-size=64M
max-heap-table-size=64M
key-buffer-size=256M

innodb_buffer_pool_size=512M
innodb_log_buffer_size=8M
#innodb_log_file_size=64M
innodb_log_file_size = 5242880
innodb_flush_log_at_trx_commit=2
innodb_thread_concurrency=8
innodb_flush_method=O_DIRECT
innodb_file_per_table
innodb_file_format=barracuda
innodb_lazy_drop_table=1

[mysqld_safe]
log-error=/home/databases/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Whats wrong with this configuration file.

Thanks & Regards

Hi msaqibansari;

It is most likely an ownership/permissions issue. Do you have SELinux or AppArmor enabled on the server? If so, try disabling it temporarily to see if that is the issue. If it is, you’ll need to update the rules to allow for the new location. If that is not it, then check the directory/file ownership and permissions on the new datadir to make sure it matches the original location to allow MySQL to properly run there.

-Scott