Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an EC2 instance set up and I'm trying to move the MySQL data directory to mounted storage.

The default data directory is:

/opt/bitnami/mysql/data

I've copied that directory entirely to

/mnt/mysql_data

Then I changed the path in my.cnf to the following:

datadir=/mnt/mysql_data

and renamed the old directory to be sure I'm using the new one.

I've given proper permissions to MySQL on the new directory - but I don't even think MySQL is trying to get there. When I try to restart mysql I get errors about the previous data directory:

sudo /opt/bitnami/ctlscript.sh start mysql
111122 18:50:50 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'.
touch: cannot touch `/opt/bitnami/mysql/data/mysqld.log': No such file or directory
chown: cannot access `/opt/bitnami/mysql/data/mysqld.log': No such file or directory
111122 18:50:50 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data
/opt/bitnami/mysql/bin/mysqld_safe: 739: cannot create /opt/bitnami/mysql/data/mysqld.log: Directory nonexistent
eval: 1: cannot create /opt/bitnami/mysql/data/mysqld.log: Directory nonexistent
111122 18:50:50 mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/ip-10-120-253-190.pid ended
/opt/bitnami/mysql/bin/mysqld_safe: 783: cannot create /opt/bitnami/mysql/data/mysqld.log: Directory nonexistent

Am I missing a configuration step somewhere? I've seen others with issues solve it by adjusting apparmor, but I don't even have the file "/etc/apparmor.d/usr.sbin.mysqld" that they're supposed to be changing. Plus, my problem doesn't seem to be that mysql can't access the new directory - it's that it's still using the old one.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Turns out Amazon's control script "/opt/bitnami/ctlscript.sh" is executing a mysql config script at /opt/bitnami/mysql/scripts/ctl.sh

Annoyingly, this script overrides a few key settings from the my.cnf file. Updating them there fixes the issue.

share|improve this answer
add comment

You have to configure mysql to use the new log directory, please edit /etc/mysql/my.cnf (in this case I'm using Debian) and update

general_log_file = /mnt/data/log

Good luck.

share|improve this answer
    
dev.mysql.com/doc/refman/5.1/en/… That looks like the name of the log file to me, not the path? My my.cnf does not have a setting for general_log_file so I would assume it should be attempting to write to the data directory. –  epalla Nov 22 '11 at 20:51
add comment

Your Answer

 
discard

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.