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:


I've copied that directory entirely to


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


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.


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.


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.

  • 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. – Matt Brunmeier Nov 22 '11 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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