I use mysqldump.exe (Size 2.281 Kb, date 22-2-2010, time 18:06)
I use MySQL Workbench 5.2 OSS Revision 6091
I have database TEST with table NAW
I use the i use the following statement to export table NAW

C:\mysqldump.exe --user=XXX --password=XXX --host=localhost test naw > c:\MybackupNAW.SQL

This export file Creation of the file goes well!
No i want to import the MybackupNAW.SQL with MySQL Workbench
Start MySQL Workbench
MySQL Workbench
Server administration
Import from disk
import from self-contained File
then i select MybackupNAW.SQL
Click button Start Import

Then i get this error:
ERROR 1046 (3D000) at line 22: No database selected

Operation failed with exitcode 1

10:54:45 Import of C:\MybackupNAW.sql has finished with 1 errors

If i create with MySQL Workbench een export file MybackupNAW2.sql with the same database and table.
Then the import works fine in MySQL Workbench !!!
I see a difference between to export files:
I the first lines of the export file with is created by MySQL Workbench is see this:

CREATE DATABASE  IF NOT EXISTS `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `test`;
-- MySQL dump 10.13  Distrib 5.1.40, for Win32 (ia32)
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version	5.1.47-community

I the first lines of the export file with is created by mysqldump.exe is see this

-- MySQL dump 10.13  Distrib 5.1.40, for Win32 (ia32)
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version	5.1.47-community

The problem is that is miss the first line "CREATE DATABASE IF NOT EXISTS......" in my export file.
Want if i put this line in export file want i created with mysqldump.exe then the import file works well in MySQL Workbench .

My question is how do I get this line automatically in my export file if I use mysqldump.exe statement!

Thanks for the reply,

Andre

Recommended Answers

All 2 Replies

C:\mysqldump.exe --user=*** --password=*** --host=localhost --databases test --tables naw > c:\MybackupNAW.sql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.