Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I Installed mysql on my CentOS 6.2 Server. But when I tried to change the location of /var/lib/mysql to another directory. I can't start the mysql. Below is what ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2012
    Posts
    12

    How to change MYSQL database directory to another directory


    Hi,

    I Installed mysql on my CentOS 6.2 Server. But when I tried to change the location of /var/lib/mysql to another directory. I can't start the mysql. Below is what I've done

    Code:
    yum install mysql mysql-server mysql-devel
    mkdir /path/to/new/
    cp -R /var/lib/mysql /path/to/new
    chown -R mysql.mysql /path/to/new
    vi /etc/my.cnf
    change datadir=/var/lib/mysql to
    datadir=/path/to/new

    Code:
    service mysqld start
    MySQL Daemon failed to start.
    Starting mysqld:                                           [FAILED]
    Did I miss something? Can anyone please help me on this, I'm a newbie in this field.

    Thank you
    Jay

  2. #2
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    710
    Hi there,

    You might get some useful information from the MySql logs in /var/log/mysql*. If there's anything that looks interesting then post it and we might be able to help you out.

    Let us know how you get on.
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

  3. #3
    Just Joined!
    Join Date
    Jun 2012
    Posts
    12
    Hi There,

    Thanks for the reply. I got it working. Seems that the problem is on selinux. I just switch it from disabled to permissive and It works.

    Thank you

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •