Import Error 1046 3d000 At Line 22 No Database Selected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack
No Database Selected Mysql Workbench
Overflow the company Business Learn more about hiring developers or posting ads with us mysql workbench import from dump project folder no database selected Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
No Database Selected Mysql Command Line
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up mySQL Workbench Importing up vote 1 down vote favorite I was trying to import it but how to import sql file in mysql workbench i am encountering some errors. this is my error: 08:49:13 PM Restoring dbDB (contact) Running: mysql --defaults-extra-file="/tmp/tmpdwf14l/extraparams.cnf" --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments ERROR 1046 (3D000) at line 22: No database selected Operation failed with exitcode 1 08:49:13 PM Restoring dbDBB (course) Running: mysql --defaults-extra-file="/tmp/tmpMW20Fb/extraparams.cnf" --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 ERROR 1046 (3D000) at line 22: No database selected mysql-workbench share|improve this question edited Jun 11 '14 at 15:40 kmas 4,836102747 asked Feb 7 error 1049 (42000): unknown database '14 at 12:52 harraypotter 46127 1 Google "mysql no database selected" of course. –Gimby Feb 7 '14 at 12:55 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted Error: You have not selected the default target schema in which to import the data from dump Create a schema/database in MySQL and select that database in MySQL Workbench while importing data from Dump. Or You can edit the dump file and append a SQL statement at the start with some thing like this create database test; use test; Solution as per the dump file of user: -- -- Table structure for table `course` -- Write the code as : create database test1; use test1; -- -- Table structure for table `course` -- This should do. share|improve this answer edited Feb 7 '14 at 13:12 answered Feb 7 '14 at 13:02 Punter015 76649 where should I put the code?? @Punter015 ? –harraypotter Feb 7 '14 at 13:06 @Pink000 Open up the dump file and append those lines at first. Or if you are using MySQL Workbencg you can create a database and then select it in the default target schema (as shown above in the picture). that would be easier for you. –Punt
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta
Mysql Import Command Line
Discuss the workings and policies of this site About Us Learn mysql import sql more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us
Mysql Create Database
Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database http://stackoverflow.com/questions/21628318/mysql-workbench-importing skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How to import a .sql file in MySQL? up vote 16 down vote favorite 6 I am trying http://dba.stackexchange.com/questions/24371/how-to-import-a-sql-file-in-mysql to import a .sql file using MySQL Workbench and I get this error: ERROR 1046 (3D000) at line 28: No database selected I have first created an empty database called with the same name as the .sql file but it doesn't work. I have also tried to do it with the mysql command client using: mysqldump -u root database > file.sql But it says a have an error in my SQL syntax. Furthermore, I don't know the path where I have to set the file.sql. mysql mysqldump import share|improve this question edited Oct 25 '12 at 4:01 RolandoMySQLDBA 108k15139274 asked Sep 14 '12 at 11:43 Barbara Dreamer migrated from stackoverflow.com Sep 16 '12 at 1:27 This question came from our site for professional and enthusiast programmers. add a comment| 7 Answers 7 active oldest votes up vote 23 down vote Export: mysqldump -u username –-password=your_password database_name > file.sql Import: mysql -u username –-password=your_password database_name < file.sql share|improve this answer edited Apr 15 at 19:51 answered Sep 14 '12 at 11:46
Community Podcasts MySQL.com Downloads Documentation Section Menu: MySQL Forums :: MySQL Workbench :: importing table dump from another machine New Topic Advanced Search Re: importing table dump from another machine Posted by: Monte Milanuk () Date: http://forums.mysql.com/read.php?152,394747,394850 November 16, 2010 02:18PM Hello Mike, Where I seem to be running aground is when I'm in that 'Import From Disk' dialog and I select the sql file (just for this example lets say https://www.daniweb.com/programming/databases/threads/317208/import-with-mysql-workbench-5-2-oss I'm using the world.sql file for the sample db 'world') and click 'Start Import'... WB responds: "ERROR 1046 (3D000) at line 22: No database selected" Fine. So I open the script in a text editor no database and add "USE world;" to the beginning and run it again: "ERROR 1049 (42000) at line 7: Unknown database 'world'" Prior to this I (re)read the 'Getting Started' tutorial in the MySQL Workbench manual, and worked through the examples described therein with no issues***. I went back, created a new EER model, named the schema 'world', set up the db connection, went through the 'forward engineer' business with no no database selected error messages, etc. and though I was good to go. Now things get more interesting... it appears that somewhere along the way I managed to get WB to use the right db. I was trying different things in the Database->Query, Database->Forward Engineer menus, but I can't say which thing it was that did it :( The good news is,now it doesn't return any errors when I try to import the sql file: "12:02:41 Import of E:\Documents\Computers\sample SQL databases\world-db\world.sql has finished" But still nothing shows up under the EER model 'world' - no tables, nothing. I double checked from the mysql console and that db *is* there, tables and all. I really like the overall look and feel of Workbench, but so far I'm more frustrated with it than I can put into words. How did: mysql -u root -p CREATE DATABASE world; USE world; SOURCE world.sql; get to be such an ordeal? ***No issues other than the EER diagram was borderline useless because of black headers on all the table objects render them completely unreadable. Navigate:Previous Message•Next Message Options:Reply•Quote Subject Views Written By Posted importing table dump from another machine 1850 Monte Milanuk 11/15/2010 11:47PM Re: importing table dump from another machine 835 Mike Li
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 mysql dre-logics -1 128 posts since Aug 2009 Community Member 2Contributors 2Replies 4Views 6 YearsDiscussion Span 6 Years Ago Last Post by dre-logics 0 pritaeas 1,895 6 Years Ago Try adding the --databases option to your command. 0 Discussion Starter dre-logics -1 6 Years Ago C:\mysqldump.exe --user=*** --password=*** --host=localhost --databases test