Moving MySQL datafile to another location
I'm brand new to MySQL/PHP/Apache and so far so good. I got all three working together, my PHP recognises calls to my MySQL database.
Here's my question:
By default all database files are located at: /var/lib/mysql/"db_name". I really need the datafile on another disk partition /data/my_data/"db_name".
To do this, I stopped MySQL, copied (cp) all datafiles from /var/lib/mysql to /data/my_data/, then
modified the /etc/my.cnf file arguement from datadir=/var/lib/mysql to datadir=/data/my_data.
Then attempted a restart of MySQL. It fails with this error:
I just changed back to the original and the base came right up.
"Initializing MySQL database: Installing all prepared tables
060125 10:41:44 [Warning] Can't create test file /data/my_data/mysql/localhost.lower-test
/usr/libexec/mysqld: Can't change dir to '/data/my_data/mysql/' (Errcode: 13)
060125 10:41:44 [ERROR] Aborting
What I'm I doing wrong? Do I need to include 'mysql' in my path?
Mike in Toronto
I Have Problems with new data Path
I have the same problem.
I have mounted a new drive at /var/lib/mysql mount point and mysql will not start
I did copy the original files from /var/lib/mysql to the new drive before mounting
so it would have the same files.....and it failed to start.
This is really frustrating because everthing looks correct !
When I umount /var/lib/mysql, then it will works normally.
060304 13:03:37 mysqld started
060304 13:03:37 [Warning] Can't create test file /var/lib/mysql/localhost.lower-test
/usr/libexec/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
060304 13:03:37 [ERROR] Aborting
060304 13:03:37 [Note] /usr/libexec/mysqld: Shutdown complete
060304 13:03:37 mysqld ended