Linux – Problem moving a MySQL data directory to a new drive

amazon ec2linuxMySQL

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?

my.cnf

[mysqld]
#datadir=/var/lib/mysql
datadir=/root/appfinder/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Set permissions for folder

chmod -R 777 /root/appfinder/mysql

mysqld.log

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/mysqld.pid ended

Best Answer

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