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 move help

Discussion in 'General Discussion' started by kosasnet, Mar 19, 2006.

  1. kosasnet

    kosasnet Member

    Joined:
    Mar 7, 2005
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    hello,

    i how to move mysql db , another partition ?

    current /var/db/mysql

    i need move to /home/mysqldb

    how to ? please help me

    thankss.
     
  2. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    Initial thoughts are to move the db simply using the mv command, then create a symlink. Haven't tried this myself, but I *think* it'll work.
     
  3. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    That would work, but you must shutdown MySQL (and chkservd) first, then move the files then create your symlinks. Finally, restart MySQL.
     
  4. kosasnet

    kosasnet Member

    Joined:
    Mar 7, 2005
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    please command write

    i create symlink, dont to be useful

    i wrote ln -s /var/db/mysql /home/mysqldb
     
  5. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    This should be all the commands to do the move and keep a backup if you mess up
    If I missed one anyone feel free to add to this

    service mysql stop

    cp -fr /var/db/mysql /var/db/mysql.old

    cp -fr /var/db/mysql /home/mysqldb

    chown -R mysql:mysql /home/mysqldb

    rm -fr /var/db/mysql

    ln -s /home/mysqldb /var/db/mysql

    service mysql start
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Personally, I'd surround that with:

    service chkservd stop

    ...

    service chkservd start

    Otherwise it could well restart MySQL in the middle of your move, which you don't want ;)
     
  7. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    Thanks :)

    Forgot that one
     
  8. kosasnet

    kosasnet Member

    Joined:
    Mar 7, 2005
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    i use freebsd , how to stop mysql ?
     
  9. aress

    aress Active Member

    Joined:
    May 5, 2004
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    kosasnet, you can start/stop mysql within /etc/rc.d/init.d/ itself.

    For eg:
    cd /etc/rc.d/init.d/
    mysql**.sh stop
    mysql**.sh start

    or else from, /usr/local/etc/rc.d/
    cd /usr/local/etc/rc.d/
    mysql**.sh stop
    mysql**.sh start
     
  10. fahed

    fahed Member

    Joined:
    Jun 13, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Instead you can add "datadir = /home/mysqldb" in my.cnf and restart mysql.
    :)
     
Loading...

Share This Page