Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use FreeBSD 8.2, mysql 5.1.58. I want change mysql default directory. I config datadir= /path OR my-data-dir= /path on my.cnf but not done. Note: i permission for /path is 755 and owner mysql:mysql. By another way, i set in /etc/rc.conf but not done

This is error, when restart mysql services.

usr/local/etc/rc.d/mysql-server restart mysql not running? (check /var/db/mysql/

Help me.

share|improve this question
When you do this and restart mysql, are you getting errors - how are you working out it is not working? – Paul Sep 22 '11 at 3:48

I assume your current MySQL data directory is the default /var/db/mysql.

  1. Stop MySQL (service mysql-server stop)
  2. Change the datadir in rc.conf (mysql_dbdir="/another/directory")
  3. mv /var/db/mysql /another/directory
  4. Start MySQL again (service mysql-server start)

If there are still problems, ensure that the directory itself and all directories inside belong to user and group mysql. (chown -R mysql:mysql /another/directory; chmod 600 /another/directory)

share|improve this answer

another way is:

move and 'ln -s' /var/db/mysql somewhere.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.