How to copy a database using HeidiSQL?

I have a local installation of MariaDB on Windows XP.
I created an empty db_y database, which I wanted to populate with db_x database db_x , which I exported as a dump file from a MySQL instance (with HeidiSQL).

When I imported the dump db_x.sql file into the MariaDB instance:

 c:\ > mysql -u root -h localhost -p db_y < "X:/archive/db_x.sql" 

I got the following:

 - MariaDB-inst +db_x +db_y 

db_y remains empty and db_x from the dump file was added (db_x is the name of the database of the source database that I exported).

What do I need to do to get the right database name?
I thought I could change the database name in the db_x.sql file, but I did not want to open such a large file.
Can I change the import command above to change the database name?
I am also interested in this solution:

 CREATE DATABASE y FROM DATABASE x 

Is this possible?
On the net, I found a RENAME DATABASE solution that was not recommended, and ALTER DATABASE db_x UPGRADE DATA DIRECTORY NAME but sincerely, I chose to create a new database with a new name. Thanks for any help.

+8
database mysql heidisql
source share
4 answers

You have two databases: source_db and target_db . If you want to copy the contents of the database from source_db to target_db , you must do as described in HeidiSQL:

  • Right-click on source_db , then select: Export Database as SQL .
  • Now change the Output value and select Database .
  • A selection window will appear, select target_db and that’s it.

enter image description here

+13
source share

There is an easy way to transfer a database from one instance to another using HeidiSQL:

  • Create db_y database on instance y
  • Click the dump icon (or right-click). Instance y must be activated.
  • In the "Exit" option, select "Database"
  • In the "Database" option, select db_y
  • Select instance x and database x on the left
  • Export
+2
source share

Try MySQL Workbench. This is done by MySQL, and I found it great for backing up the database and restoring it under a different name.

http://dev.mysql.com/downloads/workbench/

+1
source share

A new parameter, "Max INSERT size", has recently appeared in the HeidiSQL export dialog box. This controls the number of rows in arrays / multiple INSERT commands.

In addition, there is documentation for this export dialog box.

+1
source share

All Articles