Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have an EC2 instance and am trying to move the mysql data directory from the default drive to another EBS volume. I moved the mysql directory in /var/lib/mysql to the new destination and then modified the my.cnf file to point the data directory to the new location. I then tried to restart mysql I get the following message.

MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

I am running the default distribution of linux that comes with a new EC2 instance. Below are details to the my.cnf file and mysqld.log. Any suggestions on what I may be doing wrong?


# Disabling symbolic-links is recommended to prevent assorted security risks


Set permissions for folder

chmod -R 777 /root/appfinder/mysql


110616 18:37:53 mysqld_safe Starting mysqld daemon with databases from /root/appfinder/mysql
/usr/libexec/mysqld: Table 'plugin' is read only
110616 18:37:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: Log scan progressed past the checkpoint lsn 0 37356   
110616 18:37:53  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...  
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 0 44233
110616 18:37:53  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66$
InnoDB: Apply batch completed
110616 18:37:53  InnoDB: Started; log sequence number 0 44233
5110616 18:37:53 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'host' is read only
110616 18:37:53 mysqld_safe mysqld from pid file /var/run/mysqld/ ended
share|improve this question
up vote 0 down vote accepted

I tried to remount my EBS volumes to /myFolder rather than /root/myFolder. This seems to have corrected the permission issues.

share|improve this answer
Remember to accept your answer, so that it will be considered resolved. – Michael Hampton Apr 25 '13 at 17:17

/root/appfinder/mysql director must be owner mysql. For this, chown mysql:mysql /root/appfinder/mysql and chown -R mysql:mysql /root/appfinder/mysql/.

All data files for mysql must be owner mysql.

share|improve this answer
I've tried your suggestion. I used chown -R mysql:mysql /root/appfinder/mysql/, which should recursively apply to any items in the directory, but it appears to not work. – David Jun 17 '11 at 10:49

I had similar problem.

Here are my steps that did work on Ubuntu 12.04 Lts:
Want to move datafiles from /var/lib/mysql to /newdir_path/newdir

  1. sudo mysql stop
  2. sudo rsync -av /var/lib/mysql /newdir_path/newdir
  3. sudo gedit /etc/mysql/my.cnf, change datadir to /newdir_path/newdir
  4. sudo gedit /etc/apparmor.d/usr.sbin.mysqld, change:
      instead of:
      • /var/lib/mysql/ r,
      • /var/lib/mysql/** /rwk
      • /newdir_path/newdir/ r,
      • /newdir_path/newdir/** rwk,
  5. sudo /etc/init.d/apparmor restart
  6. (!!!) sudo chown mysql:mysql /newdir_path
  7. sudo start mysql
share|improve this answer
Welcome to ServerFault. Thanks for sharing what worked. Please know that gedit may not be installed in all the servers. – Pothi Sep 18 '13 at 1:31

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.