我无法从cpanel确认这一点,因为我没有访问权限,但这是从ssh和sudo连接到root的控制台的示例.有一些参数可以在/ etc / fstab中使用绑定条目而不是符号链接,但这对我有用.
我的正常程序是停止mysql,移动目录内容,链接原始内容,然后重启mysqld.
[tomh@workstation001 ~]$sudo su -
[root@workstation001 ~]#
[root@workstation001 ~]# service mysqld stop
Stopping mysqld (via systemctl):
[ OK ]
[root@workstation001 ~]# mv /var/lib/mysql/ /opt/
[root@workstation001 ~]# ln -s /opt/mysql /var/lib/
[root@workstation001 ~]# ls -la /var/lib/mysql
lrwxrwxrwx 1 root root 10 Feb 26 23:02 /var/lib/mysql -> /opt/mysql
[root@workstation001 ~]# service mysqld start
Starting mysqld (via systemctl): [ OK ]
[root@workstation001 ~]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.18-log MySQL Community Server (GPL)
mysql> show databases;
...
| Database |
+-----------------------+
| information_schema |
| mysql |
| performance_schema |
| test
所以,如果你有selinux,还有一些额外的步骤.