[BlueOnyx:19346] Re: CMU Import - append

Michael Stauber mstauber at blueonyx.it
Thu Mar 17 11:55:47 -05 2016


Hi Colin,

> If I want to move the vsites etc. on an old VPS onto an existing server (i.e. combine) what is the situation with MySQL?

Yeah, that is where it usually gets tricky. And I *really* hate doing
this, too.

Here is what I usually do: Unless there are databases that use InnoDB
you can afford to be lazy. In that case each database will have a
directory in /var/lib/mysql with the database name. Say the database is
named "furby". Then you'd stop MySQL and copy /var/lib/mysql/furby/ from
the old server to the new. Provided the new server doesn't already have
a database with the same name.

MySQL purists will probably frown at this, but it works.

The "safer" method is to do a MySQL-Dump of just the database(s) you
want to move. Then import the dump on the target server.

This works for the individual databases, but naturally not for the
rights and privileges.

The best way I found to merge these is the "pt-show-grants" command from
Percona Toolkit. See:

https://www.percona.com/doc/percona-toolkit/2.0/pt-show-grants.html

./pt-show-grants <mysql-password> > MySQLUserGrants.sql

If you install the toolkit on the source server and run the above
command, it'll dump you an SQL file with all MySQL users and their
privileges.

You can then edit that textfile and remove the duplicates such as the
user "root". Then simply run the remaining SQL commands in phpMyAdmin on
the new server to create the MySQL users and their exact rights.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list