View Full Version : Create mysql database in another location?
giavinh
11-08-2008, 09:33 AM
Hi All,
Normally DirectAdmin stores mysql database in /var/lib/mysql.
Now I want to change my database folder to /data/mysql. I did as following: edit my.cnf and put 'datadir=/data/mysql'
It's seem to be OK but when I go to DirectAdmin "MySQL Management" an error happening: "Error connecting to MySQL: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"
Then I can't create database via DirectAdmin because of that error.
Can anybody help me?
Thanks all,
Best Regards,
nobaloney
11-08-2008, 10:17 AM
I believe that DirectAdmin is hardcoded and uses linux/unix rules for placement.
If so then the best you can do is create a link; note that doing this could break your server; I take no responsibility for any damage you do:
# rm -rf //var/lib/mysql
# ln -s /data/mysql /var/lib/mysql
Jeff
giavinh
11-08-2008, 10:50 AM
Thank you so much jlasman,
I did it, but what you mean for "this could break your server" it is not good to link like this?
I just want to store mysql to another mounted hdd (/data/mysql) to share HDD works with httpd.
Cos I think that if we put all in the same hdd, the hdd will work very hard.
Thanks,
floyd
11-09-2008, 07:17 AM
I have done this on redhat based systems with no consequences.
nobaloney
11-09-2008, 01:14 PM
I meant simply that you cannot expect me to take resonsibility for anything you do on your server, even if you believe you're following my advice.
I could make a typographical error in a command and you could delete all your databases.
You could make an error in typing the command and you could delete all your databases.
Since I don't test it before writing it, I could misremember the command and you could delete all your databases.
If you have any databases in the directory you're deleting (why? I have no idea) you'd lose them when you did the delete.
Lots of ways to break your server.
I take full responsibility when you pay me to log in and do it, but if not, then you must take full responsibility.
I hope that's clear, and I hope it's acceptable.
Jeff
Powered by vBulletin™ Version 4.0.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.