Error Code 1046 No Database Selected Mysql
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 Business Learn more about hiring developers or posting mysql error 1046 3d000 no database selected ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join 1046 no database selected wordpress the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a #1046 - no database selected import minute: Sign up Error 1046 No database Selected, how to resolve? up vote 136 down vote favorite 22 Error SQL query: -- -- Database: `work` -- -- -------------------------------------------------------- -- -- Table structure for table `administrators` -- CREATE TABLE IF NOT EXISTS no database selected php `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 198k36356415 asked Oct 23 '10 at 18:19 steph 687253 5 In case anyone is interested, you can also specify the database name via the CLI command without editing the import file. mysql -u
No Database Selected Mysql Workbench Import
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 212 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,886946102 answered Oct 23 '10 at 18:21 codaddict 251k50362442 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 to add these two commands to the top of it. –bh5k Oct 11 '12 at 17:01 Thanks! This is what I needed. I had a script to create my database and tables but the tables weren't getting created because I needed to insert the USE tablename command. –ckpepper02 A
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings
Error 1046 (3d000) No Database Selected Grant
and policies of this site About Us Learn more about Stack Overflow no database selected mysql command line the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation no database selected mysqli Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it http://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve only takes a minute: Sign up Error Code: 1046. No database selected Select up vote -1 down vote favorite What seems to be wrong with my DB Error ? Im very new to SQL. Thanks <3 /* Navicat MySQL Data Transfer Source Server : Localhost Source Server Version : 50141 Source Host : localhost:3306 Source Database : tabulaDb Target Server http://stackoverflow.com/questions/27329099/error-code-1046-no-database-selected-select Type : MYSQL Target Server Version : 50141 File Encoding : 65001 Date: 2011-02-10 23:56:02 */ SET FOREIGN_KEY_CHECKS=0; -- Table structure for characters DROP TABLE IF EXISTS characters; CREATE TABLE characters ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(64) NOT NULL, slotID tinyint(4) NOT NULL, userID int(11) NOT NULL, gender tinyint(4) NOT NULL, raceID tinyint(4) NOT NULL, classID tinyint(4) NOT NULL, ad1_classId int(11) NOT NULL, ad1_hue int(10) unsigned NOT NULL, ad2_classId int(11) NOT NULL, ad2_hue int(10) unsigned NOT NULL, ad3_classId int(11) NOT NULL, ad3_hue int(10) unsigned NOT NULL, ad4_classId int(11) NOT NULL, ad4_hue int(10) unsigned NOT NULL, ad5_classId int(11) NOT NULL, ad5_hue int(10) unsigned NOT NULL, ad6_classId int(11) NOT NULL, ad6_hue int(10) unsigned NOT NULL, ad7_classId int(11) NOT NULL, ad7_hue int(10) unsigned NOT NULL, ad8_classId int(11) NOT NULL, ad8_hue int(10) unsigned NOT NULL, ad9_classId int(11) NOT NULL, ad9_hue int(10) unsigned NOT NULL, ad10_classId int(11) NOT NULL, ad10_hue int(10) unsigned NOT NULL, ad11_classId int(11) NOT NULL, ad11_hue int(10) unsigned NOT NULL, ad12_classId int(11) NOT NULL, ad12_hue int(10) unsigned NOT NULL, ad13_classId int(11) NOT NULL, ad13_hue int(10) unsigned NOT NULL, ad14_classId
Meyer Claus Meyer Pro Student 2,523 Points Problems with Mysql file (1046 - No database selected) Error SQL https://teamtreehouse.com/community/problems-with-mysql-file-1046-no-database-selected query: CREATE TABLE sizes ( id INT( 11 ) NOT https://bugs.mysql.com/bug.php?id=61821 NULL AUTO_INCREMENT , size VARCHAR( 32 ) COLLATE utf8_unicode_ci DEFAULT NULL , order INT( 11 ) NOT NULL , PRIMARY KEY ( id ) ) ENGINE = INNODB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT =5; MySQL said: Documentation 1046 - No no database 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 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
a Bug Impact on me: None Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical) Version:5.2.34 OS:Any Assigned to: View Add Comment Files Developer Edit Submission View Progress Log Contributions [11 Jul 2011 15:22] carlos villa Description: Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. How to repeat: ror Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. [11 Jul 2011 15:24] Valerii Kravchuk Do you use MySQL Workbench? What exact version of it, 5.2.x? [11 Jul 2011 15:39] Miguel Solorzano Not repeatable with 5.2.34. [11 Aug 2011 23:01] Bugs System No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". [8 Dec 2011 8:05] bruce deng Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. i got this error in the MySQL Workbench 5.2.34 CE Revision 7780 [8 Dec 2011 17:41] Valerii Kravchuk All reporters: Please, check if this problem still happens with a newer version, 5.2.36. [9 Jan 2012 7:00] Bugs System No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". [28 Jan 2012 16:00] Tolulope Eribake You need to specify a default schema for the error not to appear. [23 Sep 2012 23:05] scott markowitz 15:36:46 show index from tblprojects Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. 0.000 sec Not sure why this error is appearing. the db name is specified in the create table ddl. [24 Oct 2012 17:39] Miyuki Chan Right click the schema and make it the default schema. Then try executing it. [1 Mar 2013 21:55] Felipe Velasco I have reproduced this bug on workbench 5.2.44 CE Revision 9933. I got it when trying to do a simple join. And of course the default database was selected. Interesting that regular select (no join) worked fine Restarted workbench and everything s