Changing MySQL data directory
1.Stop MySQL server
2. Copy default mysql folder to a different location, for example /mnt/mysql
3. change datadir and socket to new location in /etc/my.cnf, for example,
datadir=/mnt/mysql
socket=/mnt/mysql/mysql.sock
4. add [client] section into /etc/my.cnf like below
[client]
socket=/mnt/mysql/mysql.sock
5. edit /etc/phpMyAdmin/config.php, change
$cfg['Servers'][$i]['host'] = 'localhost';
to
$cfg['Servers'][$i]['host'] = '127.0.0.1';
6. add below line to /etc/phpMyAdmin/config.php with new socket file location
$cfg['Servers'][$i]['socket']='/mnt/mysql/mysql.sock';
7. For TDDP, create mysql user webuser@127.0.0.1 with no password
8. change 'hostname' in /var/www/r16/global_config.php from 'localhost' to '127.0.0.1'
9. restart mysql
10.restart httpd
11. check if data directory is successfully changed by running below command
mysql -uUSER -p -e
'SHOW VARIABLES WHERE Variable_Name LIKE "%dir"'