Search code examples
mysqlconfigurationdirectoryubuntu-10.04database-partitioning

Want to move MySQL Datadir to another partition


I'd like to move all my mysql databases to another parition. I've tried the brazillion guides out there but I've not found anything that works!

Whenever I change the 'datadir' in my.cnf MySQL ceases to function!

$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Here's some more info:

$ mysqld -u root
101110 16:37:03 [Warning] Ignoring user change to 'root' because the user was set to 'mysql' earlier on the command line
101110 16:37:03 [Warning] Can't create test file /home/krainboltgreene/repo/databases/mysql/krainboltgreene-desktop-gateway.lower-test
101110 16:37:03 [Warning] Can't create test file /home/krainboltgreene/repo/databases/mysql/krainboltgreene-desktop-gateway.lower-test

And here's the conf file:

https://gist.github.com/672763


Solution

  • As @cdhowie says, it looks like you may just need to chown your new directory to mysql. This is usually accomplished through sudo chown -R mysql:mysql directoryname

    Let us know if that works.