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.

Possible to set where WHM keeps MySQL DBs?

Discussion in 'General Discussion' started by santrix, Sep 12, 2009.

  1. santrix

    santrix Well-Known Member

    Joined:
    Nov 30, 2008
    Messages:
    223
    Likes Received:
    2
    Trophy Points:
    18
    If I was to install WHM/Cpanel on a new dedicated box, which has Raid 1 OS and Raid 5 data areas, I would probably want to put the MySQL databases on the Raid 1 storage, and the rest of the user account's stuff on the Raid 5 storage. Is there a way to tell WHM where to setup MySQL DBs, as I have never seen this in any config screens.

    I have yet to delve into the command line underworld to see if how this can be done, but wanted to check there wasn't a simple way first!
     
  2. Data 1

    Data 1 Well-Known Member

    Joined:
    May 25, 2008
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Columbus Ohio
    cPanel Access Level:
    DataCenter Provider
    IMO it's easier to let it put it where it wants then move it.

    If you already know how to move things ok if not I have a tutorial I wrote for myself.

    If you partition yourself you can avoid this but some hosts (if you lease dedicated servers) just "do what they want". This puts MySQL in a very small /var partition and it must be moved if you host any sizable databases.
     
  3. santrix

    santrix Well-Known Member

    Joined:
    Nov 30, 2008
    Messages:
    223
    Likes Received:
    2
    Trophy Points:
    18
    I'm quite happy to move it after an initial install of the OS and Cpanel.

    If you could share your tutorial, I'd be grateful. I'll have to read up this week on how to find where MySQL is installed on my existing Cpanel machine. It's just one area I've not yet had to get too involved in.
     
  4. Data 1

    Data 1 Well-Known Member

    Joined:
    May 25, 2008
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Columbus Ohio
    cPanel Access Level:
    DataCenter Provider
    Quick and simple. I have no idea of your experience level but fooling around with root SSH can render the server useless with a couple typo's. Only do this if you are confident please.

    This is for servers with /var in it's own partition, usually too small. What it does is moves the entire MySQL directory inside the /home directory (traditionally the largest partition) and creates a symlink from the original location to the new one.

    Log in SSH as root. Again be careful. Run the first 3 commands, do what it says in line 4 then run line 5.

    1. mkdir /home/mysql

    2. chown mysql /home/mysql

    3. mv /var/lib/mysql/* /home/mysql

    4. delete empty original mysql directory

    5. ln -s /home/mysql /var/lib/mysql


    This was done on 3 live servers with multiple accounts. All accounts kept working flawlessly as well as the backups. All 3 servers were Centos 5 with cpanel.

    Jim
     
  5. santrix

    santrix Well-Known Member

    Joined:
    Nov 30, 2008
    Messages:
    223
    Likes Received:
    2
    Trophy Points:
    18
    Nice... I've since found my /var is actually just a directory off my home partition so I have no space restrictions. It turns out the dedi I was looking at has a far faster home partition than the mass Raid 5 storage (it's hanging off a large SAN which is not - in practice - as good as the drives built into the blade.

    Using a link is a good idea - saves a lot of faffing about with reconfiguring mysql I guess, and if you say it's working well in a production environment, then it must be an appropriate method.

    Cheers
     
Loading...

Share This Page