Moving Mysql to /home directory, websites are fine but The MySQL server is currently offline.

Renda

Registered
Jul 22, 2016
3
0
1
Cary
cPanel Access Level
Root Administrator
Hi this is my first thread. I love cpanel so much, it brings so much convince.
Let me briefly introduce my situation here.

Due to reach /var limitation. I moved /var/lib/mysql to /home/data/mysql directory
and than I removed the mysql folder in /var/lib/
Websites all are fine, I can manager database from whm.
I can manager database from website backends by using Adminer in Joomla.
Server status in WHM shows Mysql is up.

ISSUE:
When I logined to cpanel,
All of database session are malfunctional.
Phpmyadmin cannot be loaded,
Mysql Database shows following error message:
The MySQL server is currently offline.
Mysql::initcache() failed: The mysql server is offline.

Attempt:
I did research and tried to reset password on mysql root and users.
And I tired use
# /scripts/checkperlmodules –full –force
# /scripts/upcp –force
None of above are working.


Could you help me find out how to solve this issue?
 

twhiting9275

Well-Known Member
Sep 26, 2002
560
27
178
cPanel Access Level
Root Administrator
Twitter
You need to have a professional administrator doing this stuff. You likely just broke everything.
Make sure you adjust the directory path in MySQL configuration
Make sure you create a symlink from new to old directory
 

Renda

Registered
Jul 22, 2016
3
0
1
Cary
cPanel Access Level
Root Administrator
You need to have a professional administrator doing this stuff. You likely just broke everything.
Make sure you adjust the directory path in MySQL configuration
Make sure you create a symlink from new to old directory
Hi Thank you for your reply.
I thought I messed up with some symlink or directory path. but the wired thing is all of my websites are fine.

I follow exactly the same way in instruction on move mysql to /home/data path

Code:
"
1. Stop MySQL
Before making any changes, first make sure to stop mysql service
refer to : - Removed -
# service mysqld stop

2. Change Data Directory
Now copy default MySQL data directory (/var/lib/mysql) to other location as per your requirement. Also set the required MySQL ownership on new directory location. As per below command, we are relocating data directory to /data/mysql.

# cp -rap /var/lib/mysql /data/mysql
# chown mysql.mysql /data/mysql

Now edit MySQL default configuration file /etc/my.cnf and update values of datadir and socketvariable.

Change From:
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

Change To:
datadir=/data/mysql
socket=/data/mysql/mysql.sock

3. Start MySQL
After making all above changes. finally start MySQL service. Now it will use new data directory path

# service mysqld start
"
 
Last edited by a moderator:

ssfred

Well-Known Member
Jan 6, 2012
65
4
58
India
cPanel Access Level
Root Administrator
Twitter
Hello

Are you able to connect to the MySQL server through back end as "root" and execute some db operations? If so the issue is less likely to be related with the data directory change. Check the cPanel logs and MySQL logs as well. As the issue happens only to cPanel, I think changing the theme may sometimes help. I remember one such incident with x3 theme.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
Hi this is my first thread. I love cpanel so much, it brings so much convince.
Welcome to the cPanel forums! We're happy you decided to post here.

Problem solved. by adding symlink for /var/lib/mysql to point to /home/data/mysql.

Thanks all above =)
I'm happy to see you were able to address the issue. Thank you for updating us with the outcome. Feel free to post again if you have any additional questions.
 

Bidi

Well-Known Member
Oct 3, 2012
101
6
68
Romania, Transilvania
cPanel Access Level
DataCenter Provider
I dont understand how i made the same the mysql is on but the websites ar not able to connect to bases , i can manage them from cpanel/whm ...etc but websites not connecting to them, after i reverse the changes and now

ervice Error
(XID qadjd6) The “mysql” service failed to start.

Startup Log
Starting MariaDB.191212 05:55:48 mysqld_safe Logging to '/var/lib/mysql/d9.domain.ro.err'.
191212 05:55:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
.../etc/init.d/mysql: line 264: kill: (3773210) - No such process
ERROR!

mysql has failed. Contact your system administrator if the service does not automagically recover.

I changed the root mysql password the mysql started but the websites still not able to connect to database :|
 
Last edited: