Mysql Query Browser Error 1046
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 Overflow the company error 1046 no database selected mysql workbench Business Learn more about hiring developers or posting ads with us Stack Overflow Questions error 1046 no database selected phpmyadmin Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, no database selected mysql php just like you, helping each other. Join them; it only takes a minute: Sign up Error 1046 No database Selected, how to resolve? up vote 137 down vote favorite 22 Error SQL query: -- -- Database:
Error 1046 (3d000) No Database Selected Grant
`work` -- -- -------------------------------------------------------- -- -- Table structure for table `administrators` -- CREATE TABLE IF NOT EXISTS `administrators` ( `user_id` varchar( 30 ) NOT NULL , `password` varchar( 30 ) NOT NULL ) ENGINE = InnoDB DEFAULT CHARSET = latin1; MySQL said: #1046 - No database selected need some help here. sql mysql mysql-error-1046 share|improve this question edited Oct 23 '10 at 18:21 OMG Ponies 199k37360417 asked Oct 23 '10 at 18:19 steph 692253 no database selected mysql workbench import 5 In case anyone is interested, you can also specify the database name via the CLI command without editing the import file. mysql -u root -p databasename < import.sql –Sam Dufel Nov 24 '14 at 15:36 what happened to me was: create a schema, filled in the name of the database, then it says "fail, no database selected". reopen workbench, i see database that i have just failed to created. Then I choose the database that i have just created, and open a .sql file and run, with both create database and use database statements, it complains "fail no database selected" again. reopen workbench, the tables are all built. MAC system, workbench 6.3.3 –Tiina Jun 9 at 9:12 add a comment| 13 Answers 13 active oldest votes up vote 216 down vote You need to tell MySQL which database to use: USE database_name; before you create a table. In case the database does not exist, you need to create it as: CREATE DATABASE database_name; followed by: USE database_name; share|improve this answer edited Feb 24 '13 at 0:02 Piero 2,991946102 answered Oct 23 '10 at 18:21 codaddict 252k50362443 2 In my case, I had used mysqldump to export a database and was running into this upon import. I just had to edit the exported sql file t
Meyer Claus Meyer Pro Student 2,523 Points Problems with Mysql file (1046 - No database selected) Error SQL error code 1046 in mysql workbench query: CREATE TABLE sizes ( id INT( 11 ) NOT
No Database Selected Mysql Command Line
NULL AUTO_INCREMENT , size VARCHAR( 32 ) COLLATE utf8_unicode_ci DEFAULT NULL , order INT( 11 ) NOT
No Database Selected Mysqli
NULL , PRIMARY KEY ( id ) ) ENGINE = INNODB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT =5; MySQL said: Documentation 1046 - No http://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve database selected No good, if you get problems just importing a file! Problem is that I cant write "Create table" 1 Answer Petros Sordinas 15,723 Points Petros Sordinas Petros Sordinas 15,723 Points about 2 years ago You have to tell SQL which database you are using Either : USE database_name; or if the database https://teamtreehouse.com/community/problems-with-mysql-file-1046-no-database-selected does not exist CREATE DATABASE database_name USE database_name; Claus Meyer Pro Student 2,523 Points Claus Meyer Claus Meyer Pro Student 2,523 Points 2y ago THANKS, I got it to work now... Oki, my database name is: movikcrewhunter USE movikcrewhunter; CREATE TABLE sizes ( id int(11) Posting to the forum is only allowed for members with active accounts. Please sign in or sign up to post. Our mission is to bring affordable, technology education to people everywhere, in order to help them achieve their dreams and change the world. Our Company About Us Contact Us Community Treehouse Stories Student Perks Treehouse Blog Affiliate Program Careers Topics HTML CSS Design JavaScript Ruby PHP WordPress iOS Android Development Tools Business Tracks Web Design Web Development Rails Development PHP Development iOS Development Android Development WordPress Development Starting a Business Treehouse Blog About Treehouse Privacy Policy Terms & Conditions © 2016 Treehouse Island, Inc. Sign in Email Address Password I forgot my password Sign in
Impact on me: None Category:MySQL Query Browser Severity:S1 (Critical) Version:1.0.1 OS:Microsoft https://bugs.mysql.com/bug.php?id=4391 Windows (Windows XP SP1) Assigned to: Michael G. Zinner View Add Comment Files Developer Edit Submission View Progress Log Contributions [3 Jul 2004 2:34] http://dba.stackexchange.com/questions/24371/how-to-import-a-sql-file-in-mysql Andrew Description: I open query browser, click on the database and then the table, and then type select * from interfaces; and it no database says at the bottom "No Database Selected Error Nr 1046" How to repeat: I open query browser, click on the database and then the table, and then type select * from interfaces; and it says at the bottom "No Database Selected Error Nr 1046" [3 Jul 2004 2:36] no database selected Andrew i'm using 1.0.1a by the way [4 Jul 2004 12:47] Michael G. Zinner You have to specify the default schema at connection time (see the Schema: edit in the Connection Dialog) or by selecting File > Change Default Schema or by executing USE databasename. If you do not specify a default schema at connection time, all schemata are equal. You have to do a select like this: SELECT * FROM forum.posts Legal Policies Your Privacy Rights Terms of Use Contact Us Portions of this website are copyright © 2001, 2002 The PHP Group Page generated in 0.020 sec. using MySQL 5.7.12-enterprise-commercial-advanced-log Content reproduced on this site is the property of the respective copyright holders.It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party. © 2016, Oracle Corporation and/or its affiliates
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 Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us 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 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 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 108k15141276 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 juergen d 38139 6 There has to be no space between -p and password –tombom Sep 14 '12 at 11:47 What if I don't have a password? –Barbara Dreamer Sep 14 '12 at 11:57 Then skip password parameter. –Kazimieras Aliulis May 31 '13 at 10:35 Piping (mysqldump db -uuser -ppass|mysql new_db -uuser -ppass) removes the need to use an intermediate file. –Pacerier Oct 12 '15 at 10:05 The database has to exist in MySQL for this to work, I think. –Noumenon Feb 5 at 2:02 add a comment| up vote 8 down vote You can also import an .sql file as an already connected user to the database manner : mysql> use your_database_name; mysql> source file.sql; share|improve this answer edited Jul 11 '13 at 9:37 Nick Chammas 9,003115591 answered Jul 11 '13 at 8:44 tdaget 12027 1 source D:/path/file.sql; works superb! remember the front slash instead of