Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    254

    Smile Move database to second disk

    Hello

    I want to move my database to my second disk and i was read that i must found the folder for mysql that contains all that info and to copy it in the second disk and then set from my.cnf the path to lod it from the second disk.

    How can i locate this folder?

    Is there something else to do for that to work?

    Thank you

  2. #2
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,554
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    Quote Originally Posted by ASTRAPI View Post
    I want to move my database to my second disk and i was read that i must found the folder for mysql that contains all that info and to copy it in the second disk and then set from my.cnf the path to lod it from the second disk.

    How can i locate this folder?

    Is there something else to do for that to work?
    MySQL databases are typically stored within the following directory path:
    Code:
    /var/lib/mysql/
    When moving the MySQL data directory, as seen above, it is usually required to update the MySQL configuration file (at "/etc/my.cnf") and as a precaution one may want to create a symbolic link (symlink) from the original path to the new path.

    When performing any changes the MySQL server should be fully shutdown and not actively running to minimize the potential for data loss. Due to the risk involved extreme caution is advised.

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    254

    Default

    create a symbolic link
    How can i create this?


    Thank you

  4. #4
    Member
    Join Date
    Sep 2003
    Posts
    158

    Default

    ln -s /path/to/mysqlnewdirectory mysqlolddirectory

  5. #5
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,554
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    Quote Originally Posted by ASTRAPI View Post
    create a symbolic link
    How can i create this?
    Quote Originally Posted by boatdesign View Post
    ln -s /path/to/mysqlnewdirectory mysqlolddirectory
    The example posted by boatdesign is valid. Here is another example just for clarification; as a precaution I've added an additional option "-n" and enabled verbose output:
    Code:
    # ln -nsv /new/path/to/mysql /old/path/to/mysql
    For usage information I recommend referring to the manual "man" page and help documentation for "ln":
    Code:
    # man ln
    # ln --help
    If the MySQL data directory was moved to a directory path at "/new/mysql/" and if the old location is the same as the stock-default (at "/var/lib/mysql/"), the command to create a symlink could look like the following:
    Code:
    # ln -nsv /new/mysql /var/lib/mysql
    Warning: Any changes to the MySQL data directory should be performed only while MySQL is shutdown.

  6. #6
    Member
    Join Date
    Jul 2008
    Posts
    254

    Default

    Is it better to copy the directory and all contents of it or just a few files?

    Thank you

Similar Threads & Tags
Similar threads

  1. Database on the second disk and cpanel settings
    By ASTRAPI in forum New User Questions
    Replies: 0
    Last Post: 06-07-2010, 03:47 PM
  2. Move Apache domlogs to second disk drive
    By MMarko in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-15-2008, 08:42 AM
  3. Move a database from one account to another
    By Abbas in forum Database Discussions
    Replies: 1
    Last Post: 10-29-2008, 06:48 AM
  4. How do you move one database into another?
    By breakaway in forum Database Discussions
    Replies: 3
    Last Post: 04-15-2007, 03:01 AM
  5. Disk / Account move problem
    By xeonxl in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 05-24-2006, 04:42 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube