[BlueOnyx:19347] Re: CMU Import - append
Colin Jack
colin at mainline.co.uk
Thu Mar 17 12:12:48 -05 2016
Thanks Michael,
> 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.
This was a trick that you taught me before and it works fine. :)
> 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.
That sounds like a perfect solution. I will try and see what I can do without too much damage!
All the best
Colin
More information about the Blueonyx
mailing list