Move Mysql Other directory: help

Joined
Feb 17, 2017
Messages
64
Best answers
0
Ratings
3
Points
8
#1
Hi:

I'm following this manual to move the mysql directory

https://forums.cpanel.net/threads/how-to-move-mysql-data-directory.110481/

but there is something wrong

ln -s / home / mysql / var / lib / mysql
ln: failed to create symbolic link '/ var / lib / mysql / mysql': File exists


and in addition to finishing the steps, the database is still recorded in the old directory
 

KnownHost-DanielP

Well-known member
Joined
Mar 1, 2018
Messages
121
Best answers
2
Ratings
26 3
Points
28
#2
I'm going to assume /var and /home are two different mounts so you need more space and this is how you're accomplishing it.

So here's a quick list of commands for how I would accomplish this:
Code:
# Stop MySQL
systemctl stop mysqld
# Verify MySQL directory size
du -h --max-depth=1 /var/lib/mysql 
# Move the MySQL directory
mv /var/lib/mysql/ /home
# Verify the size has moved
du -h --max-depth=1 /home/mysql
# Symlink them
ln -s /home/mysql /var/lib/mysql
# restart mysql
systemctl start mysqld
You need to make sure the mysql directory in /var/lib is gone to symlink it to home so that might be the only step your missing.
 

KnownHost-DanielP

Well-known member
Joined
Mar 1, 2018
Messages
121
Best answers
2
Ratings
26 3
Points
28
#10
Hmmm, if MySQL is booting that's a good sign, but if no one can access it perhaps we have a permission issue.

So
Code:
cd /home/mysql
ls -lah
This will show the ownership and permissions of the folders and we can make sure everything is owned by mysql:mysql for user and group and has at least 700 permissions for db folders and 751 for the main mysql folder.
 

KnownHost-DanielP

Well-known member
Joined
Mar 1, 2018
Messages
121
Best answers
2
Ratings
26 3
Points
28
#12
Permissions look correct.

I'd say your next step would be to try and manually connect to the database.

So

Code:
mysql -u username -p 
# then
use valvps_whmcs;
show tables;
Replace username with your MySQL user and password with that db password. If that works then the problem is somewhere else, apache/php perhaps. If not then we've still got issues somewhere in MySQL
 

David Beroff

Well-known member
Joined
Jun 14, 2016
Messages
840
Best answers
0
Ratings
56
Points
28
#13
Seem KnownHost-DanielP is an web hosting expert here, why (valvps) don't send him server account and ask him to look into it and solve the problem directly? If he can fix it for you then you can reason or solutions that he used. That's better to ask via images :)
 

KnownHost-DanielP

Well-known member
Joined
Mar 1, 2018
Messages
121
Best answers
2
Ratings
26 3
Points
28
#16
I'd say make sure to fully restart apache as it's possible something is hung up with the MySQL location.

Alternatively look for error_log files in your home directory that may give more detailed errors.

So for now

Code:
systemctl restart httpd
and try again.
 
Joined
Feb 17, 2017
Messages
64
Best answers
0
Ratings
3
Points
8
#19
Well, update Mysql to the latest version

and this has solved the problem.


I want to thank you for taking the time to help me

thank you very much.
 
Latest Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.