Page 1 of 1

How can i use another data folder for mySQL?

PostPosted: 14. November 2009 14:00
by web.designer.iq
Hi
I've a MySQL data folder in /home/MySQL-Data
How can i use this folder as default for MySQL Data (Databases)?

Re: How can i use another data folder for mySQL?

PostPosted: 14. November 2009 14:40
by Nobbie
Yes.

If you use Xampp, edit /opt/lampp/bin/mysql.server and search for "datadir". You will find an empty assignment like:

Code: Select all
datadir=


Simply apply the folder you like and restart MySQL.

If you dont use Xampp, you may as well edit the MySQL Configuration file my.cnf (usually in /etc) and search for the section [mysqld]. Apply the datadir=/home/... Directive there and alsol restart MySQL.

And finally proceed to http://dev.mysql.com/doc/refman/5.1/en/ ... files.html and read about how to configure MySQL runtime options (for future questions).

P.S.: Beware you grant the desired permissions to the datadir folder, as MySQL server usually runs with different userid than yours.

Re: How can i use another data folder for mySQL?

PostPosted: 24. November 2009 09:22
by xsoho
I done!!
but there are error in the starting MysQL!~!!

Re: How can i use another data folder for mySQL?

PostPosted: 24. November 2009 10:49
by Nobbie
And? I cannot read your minds and I cannot watch your screen. Will you please tell us what kind of errors? Any messages?

P.S.: When you want to use a different data folder than the default folder, you MUST OF COURSE copy all the contents of the default data folder to the new data folder. You CANNOT use multiple data folders. And (once again): you have to grant appropriate permissions to the data folder (and all folders and files beyond).

Re: How can i use another data folder for mySQL?

PostPosted: 24. November 2009 10:55
by xsoho
Hi
I've a MySQL data folder in /www/mysql ,the partition is different from /opt/lampp/var /mysql
How can i use this folder as default for MySQL Data (Databases)?

Msn :fm3698@gmail.com

Re: How can i use another data folder for mySQL?

PostPosted: 24. November 2009 11:19
by Nobbie
Look above and read my first answer in the thread.