- Identify the database files you wish to migrate into the new data directory
You can use the following command to list the current databases in mysql
mysqlshow -u root -p
Keep this list available as you will reference it in a later step - Shutdown the MySQL database, if it is running
mysqladmin -u root -p shutdown
[mysqld_safe] datadir = /opt/oss/var/mysqlto
[mysqld_safe] datadir = /opt/oss/var/mysql/data
mkdir -p /optoss/var/mysql/data
You may need to modify the directory settings using chown and chmod
mv test /opt/oss/var/mysql/dataNote: You can use the copy (cp) command instead if you prefer. Remember to remove the copied files once the migration is complete You will need to move/copy each database into the new data directory
openpkg rc mysql startThe database files will now be managed under the new data directory. If you encounter any problems during startup, you check the hostname.err file located in the data directory.
If you are using some security software like Apparmor (which is installed on major default server distributions), think about editing the appropriate configuratio file
No comments:
Post a Comment