I'm trying to move data files of a MySQL installation to another place, but it won't work.
When trying to start mysqld, I get this in /var/log/mysql/error.log
:
110922 7:27:40 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110922 7:27:40 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110922 7:27:40 InnoDB: Initializing buffer pool, size = 512.0M
110922 7:27:40 InnoDB: Completed initialization of buffer pool
110922 7:27:40 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
The above happens even if I try something as innocent as:
sudo cp -a /var/lib/mysql /var/lib/mysql2
...and change the datadir
setting in /etc/mysql/my.cnf
to /var/lib/mysql2
(I get the same result if I leave my.cnf
as it is, and create a symlink named mysql2 to point to mysql.)
This is somewhat perplexing. File permissions are exactly the same in the copied datadir. And obviously I'm stopping/starting the daemon before doing these changes (sudo service mysql stop
etc.) Any idea what I'm doing wrong?
This is Ubuntu 11.04 on Amazon EC2 (64-bit m1.large instance).
(In reality I'd like to move MySQL data to another EBS volume, to a path such as /mnt/data/mysql
or /data/mysql
, but the above minimal scenario suffices to reproduce the problem.)