The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Database Discussions' started by Renda, Jul 22, 2016.

Tags:
  1. Renda

    Renda Registered

    Joined:
    Jul 22, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  2. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    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
     
  3. Renda

    Renda Registered

    Joined:
    Jul 22, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Cary
    cPanel Access Level:
    Root Administrator
    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
    "
    
     
    #3 Renda, Jul 22, 2016
    Last edited by a moderator: Jul 22, 2016
  4. twhiting9275

    twhiting9275 Well-Known Member

    Joined:
    Sep 26, 2002
    Messages:
    538
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    If you don't know what you're doing, don't do it. Just because someone posted something on the interwebs as to 'how to do this' doesn't mean it works... This will end up killing services
     
  5. ssfred

    ssfred Well-Known Member

    Joined:
    Jan 6, 2012
    Messages:
    62
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    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.
     
  6. Renda

    Renda Registered

    Joined:
    Jul 22, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Cary
    cPanel Access Level:
    Root Administrator
    Problem solved. by adding symlink for /var/lib/mysql to point to /home/data/mysql.

    Thanks all above =)
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Welcome to the cPanel forums! We're happy you decided to post here.

    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.
     
Loading...

Share This Page