1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change mysql database directory

Discussion in 'General Discussion' started by Kailash1, Mar 19, 2008.

  1. Kailash1

    Kailash1 Member

    Joined:
    Nov 27, 2006
    Messages:
    234
    Likes Received:
    2
    Trophy Points:
    18
    Hi,

    I have stored Mysql database in /var/lib/mysql location and now /var is about to reach its allocated space. Is there any way I can change the location and move the existing Mysql databases to new location?

    Thanks,

    Kailash
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,288
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Houston, TX
    This thread may help: http://forums.cpanel.net/showthread.php?t=71424

    That thread also links to another thread that may help.
     
  3. Marty

    Marty Member

    Joined:
    Oct 10, 2001
    Messages:
    647
    Likes Received:
    1
    Trophy Points:
    18
    cd /var/lib

    service chkservd stop

    service mysql stop

    mv mysql /home

    ln -s /home/mysql mysql

    service mysql start

    service chkservd start

    That is the way I do it. Use at your own risk. I think I have ln -s command correct.
     
    jugo likes this.
  4. Kailash1

    Kailash1 Member

    Joined:
    Nov 27, 2006
    Messages:
    234
    Likes Received:
    2
    Trophy Points:
    18
    Thanks David and Marty.

    And sorry for the duplicate post.

    Kailash
     
  5. Kailash1

    Kailash1 Member

    Joined:
    Nov 27, 2006
    Messages:
    234
    Likes Received:
    2
    Trophy Points:
    18
    Will it create any problem taking cPnel backup (including MySQL databases) after changing the location of MySQL databases.

    Thanks,

    Kailash
     
  6. Marty

    Marty Member

    Joined:
    Oct 10, 2001
    Messages:
    647
    Likes Received:
    1
    Trophy Points:
    18
    No, the backups will follow the symlink, so there is no problem at all.
     
  7. Kailash1

    Kailash1 Member

    Joined:
    Nov 27, 2006
    Messages:
    234
    Likes Received:
    2
    Trophy Points:
    18
    Thanks Marty,

    Kailash
     
  8. jugo

    jugo Member

    Joined:
    Nov 23, 2005
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Worked for me....

    Thanks.:D
     

Share This Page