We help IT Professionals succeed at work.

MySQL _ Import

Brogrim asked
I am using MySQL workbench 5.2.25 CE

I have backed up my Database in  a self contained file.

I want to import the database but do not want to restore it, How can I ensure that the database is created but under a different name. example db_development.

I want to leave the database that users are currently working on but need a copy of the database to test some sql statements.
Watch Question

Check the first few lines of the .sql file you created, but I doubt it has the CREATE DATABASE instruction in it.  Assuming it does not, do a

Create Database db_development;
Use db_development;

Then restore that database from the file.
BrogrimInformation Systems Development Manager


The SQL file is nearly 4 GB, I have tried to open it on workbench.

I am getting a message that it is unable to allocate that much memory to open the file.
Do you have command-line access to mysql?  If so, using the

Open in new window

command should go well.
BrogrimInformation Systems Development Manager


Sorry Daniel, I don't understand the question.

Are you referring to the Command Prompt?

If so I would not be proficient (No Idea) in using this to access MySQL
At the command prompt:
>mysql -u MyUserName -p
mysql> create database db_development;
mysql> use db_development;
mysql> source MyBigBackupFile.sql;
mysql> exit;

Open in new window