[MySQL Data Directory migration dislocation] Error resolution
It takes about 4 steps,
The 1th step is to stop the database through service MySQL stop.
2nd move the data file, do not know whether the reason for Ubuntu intelligence, when moving the database, in addition to the data files, even permissions to bring the past
[Email protected]:~ #mv/var/lib/mysql/home/
I also record/var/lib/mysql the permissions of each directory, when the MV is complete,/home/the following permissions to retain the original/var/lib/mysql all kinds of permissions, including directories, files and so on, even chown,chmod are easy.
This is going to be okay, the 4th step is not to start, look at the log file/var/log/mysql/error.log results are
/usr/sbin/mysqld:can ' t find file: './mysql/plugin.frm ' (errno:13) 100803
12:36:36 [ERROR] Can ' t open the Mysql.plugin table.
Please run Mysql_upgrade to create it.100803 12:36:36
Innodb:operating system error number in a file operation.
Innodb:the error means mysqld does not has the access rights to
Innodb:the directory.
Innodb:file name/ibdata1innodb:file operation call: ' Open '.
Innodb:cannot continue operation.
Just now MV past permissions are right, there is no question of what permissions, to the online search is mostly Redhat series of systems, of which SELinux does not apply to Ubuntu, but also almost really use Chcon to modify the so-called security and other rights
In fact, the comment section in the my.cnf is clearly explained
# * important# If You do changes to these settings and your system uses AppArmor, you may# also need to also adjust/etc /apparmor.d/usr.sbin.mysqld.
Follow the instructions for the 3rd step, comment out the original path, add a new path, 2 lines to modify
[Email protected]:~# vi/etc/apparmor.d/usr.sbin.mysqld
#/var/lib/mysql/r,#/var/lib/mysql/** rwk, changed to/HOME/MYSQL/R,/home/mysql/** Rwk,
Update parameters
[Email protected]:~#/etc/init.d/apparmor Reload
* Reloading AppArmor Profiles Skipping profile In/etc/apparmor.d/disable:usr.bin.firefox [OK]
Follow the 4th step after the modification is completed [email protected]:~# service MySQL start
You can see the boot success in the log
/var/log/mysql/error.log
100803 12:53:07 innodb:started; Log sequence number 0 5646278
100803 12:53:07 [Note] Event scheduler:loaded 0 Events
100803 12:53:07 [Note]/usr/sbin/mysqld:ready for connections.
Version: ' 5.1.41-3ubuntu12.4-log ' socket: '/var/run/mysqld/mysqld.sock ' port:3306 (Ubuntu)
This article is from "Marching toward the fire!" "Blog, be sure to keep this provenance http://zhaopeiyan.blog.51cto.com/10522430/1968405
Change directory after MySQL installation