[kwlug-disc] how to duplicate a mysql database?

Robert P. J. Day rpjday at crashcourse.ca
Wed Aug 26 03:44:22 EDT 2009

On Tue, 25 Aug 2009, Khalid Baheyeldin wrote:

> It is actually difficult to do what you have seen. The hardest part
> is assigning permissions for a user. You can skip that if you are
> testing with root.

  yes, i'll be testing as root, so i assume i can skip that "GRANT"

> # mysqladmin create newdb
> # mysql
> mysql> GRANT ALL ON newdb.* to someuser at localhost IDENTIFIED BY 'somepass';
> ^D
> # mysqldump olddb | mysql newdb

  i'd seen a number of solutions that did that last part in two steps:
dump the db to a file, then run mysql as a separate command.  so
there's nothing wrong with using a pipe and driving the output to the
input?  good.  i thought that was acceptable, i just wanted to make

  of course, all will be backed up thoroughly. :-)


Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday

More information about the kwlug-disc mailing list