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.

mysql datadir

Discussion in 'General Discussion' started by benito, Aug 4, 2006.

  1. benito

    benito Well-Known Member

    Joined:
    Jan 8, 2004
    Messages:
    296
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Mar del Plata - Argentina
    Hi!

    What is the best way to change the mysql datadir on cpanel ? I have a spare disk on server and want to use is only for databases.

    This steps are ok for a cpanel ?

    1- Copy files from /var/lib/mysql to /newdisk/database
    2- Add this line to my.cnf : datadir = /newdisk/database
    3- Restart mysql
     
  2. Anishts

    Anishts Active Member

    Joined:
    Oct 6, 2005
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Hi

    It should work. Before that you have to stop mysql server.
    then
    cp -rpa /var/lib/mysql /newdisk/database. (only copy dont move)
    Then edit your my.cnf as you said. Then start mysql . If everything is ok then you can remove old data directory.

    Another suggestion is use second drive as a back up drive for cpanel. I think this is the best choice. So that you can back up entire useraccounts and their databases on that drive. Head ache from disk failure will be less :)
     
Loading...

Share This Page