Mysql Error 1064 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 #1046 - no database selected import site About Us Learn more about Stack Overflow the company Business Learn more
No Database Selected Php
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
No Database Selected Mysql Workbench Import
Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error 1046 No
Error 1046 (3d000) No Database Selected Grant
database Selected, how to resolve? up vote 137 down vote favorite 22 Error SQL query: -- -- Database: `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 no database selected mysql command line 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 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
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 #1046 - no database selected wordpress Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags no database selected mysqli Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve error code 1046 in mysql workbench 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 http://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve and rise to the top Error 1046 Mariadb: No database selected up vote 3 down vote favorite 1 GRANT ALL ON my-database.* TO my-user@10.0.0.1 IDENTIFIED BY 'password'; ERROR 1046 (3D000): No database selected Ok, I have created a database with a "-" on the name (did the same thing on the user)... then when I try to set the grants on it the database wont work. If I use the base the error is different MariaDB http://dba.stackexchange.com/questions/27245/error-1046-mariadb-no-database-selected [(none)]> use my-base Database changed MariaDB [my-base]> GRANT ALL ON 'my-base'.* TO 'my-user'@'10.0.0.1' IDENTIFIED BY 'password'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''my-base'.* TO 'my-user'@'10.0.0.1' IDENTIFIED BY 'password'' at line 1 MariaDB [my-base]> mariadb share|improve this question edited Mar 8 at 22:54 RolandoMySQLDBA 108k15139276 asked Oct 19 '12 at 14:27 maniat1k 1702516 1 In regards to the second error if you set your database, if you're not running in ANSI-quote sql_mode, ' doesn't escape a database object. Use the back tick ` –Derek Downey Oct 19 '12 at 15:03 1 Slight correction to myself...ANSI_QUOTES affects the double-quotes for escaping...single-quotation never does :) –Derek Downey Oct 19 '12 at 15:14 add a comment| 1 Answer 1 active oldest votes up vote 8 down vote accepted Try escaping it with backticks? GRANT ALL ON `my-database`.* TO `my-user`@`10.0.0.1` IDENTIFIED BY 'password'; Also, if you already have a user my-user@10.0.0.1, you don't need to provide the IDENTIFIED BY... portion of your grant statement share|improve this answer answered Oct 19 '12 at 14:31 Derek Downey 15.8k74885 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Passwor
Aug 2014 15:49 Reporter: Flavian C Email Updates: Status: Verified Impact on me: None Category:MySQL Server: Parser Severity:S3 (Non-critical) Version:5.5.26 5.6.19 OS:Any Assigned to: Triage: https://bugs.mysql.com/bug.php?id=73590 Needs Triage: D4 (Minor) View Add Comment Files Developer Edit Submission View Progress Log Contributions [14 Aug 2014 17:56] Flavian C Description: If we use multi-join inside a join http://www.inmotionhosting.com/support/website/phpmyadmin/import-database-using-phpmyadmin the update query asks for DB name ERROR 1046 (3D000): No database selected How to repeat: Im getting no database select when using JOIN inside a JOIN. UPDATE DB1.TABLE1 no database as a JOIN (SELECT * FROM DB1.TABLE2 as b,(SELECT * DB1.TABLE2) as c WHERE b.col1 = c.col1) ea JOIN (SELECT SUM(d.size) FROM DB1.TABLE2 as d WHERE d.col1=xx) ef ON a.col1=ea.col1 and a.col1=ef.col1 set xxxx Also if ea alias join if we convert the inside join to subquery it works properly but takes a performance hit. i.e UPDATE DB1.TABLE1 as no database selected a JOIN (SELECT * FROM DB1.TABLE2 as b WHERE b.col1 = (SELECT c.col1 DB1.TABLE2 as c)) ea JOIN (SELECT SUM(d.size) FROM DB1.TABLE2 as d WHERE d.col1=xx) ef ON a.col1=ea.col1 and a.col1=ef.col1 set xxxx [14 Aug 2014 18:00] Sveta Smirnova Thank you for the report. Please specify which exact minor version of MySQL server you use and provide output of SHOW CREATE TABLE for all involved tables. [14 Aug 2014 18:28] Flavian C Just for test case you can do: Do not do " use dbname " login into mysql : execute the following CREATE TABLE flavian.`test1` ( `col1` int(3) DEFAULT NULL, `col2` int(3) DEFAULT NULL, `col3` int(3) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE flavian.`test2` ( `col1` int(3) DEFAULT NULL, `col2` int(3) DEFAULT NULL, `col3` int(3) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; mysql> update flavian.test1 a JOIN (select * from flavian.test2 b, (select * from flavian.test2 c where c.col1=1 limit 1) d where b.col1=d.col1) ea JOIN (select sum(e.col2) from flavian.test2 e where e.col1=1) ef set a.col2=ea.col2, a.col3=ef.col3 where a.col1=1 and a.col2=2; ERROR
DOMAINS WEB DESIGN WEB DESIGN SERVICES CREATE YOUR OWN WEBSITE SITE HOSTING TOOLS MEET US MEET US ABOUT US PARTNERS & AWARDS BLOG WE'RE HIRING CONTACT US AMP LOGIN SUPPORT CENTER Search Support Center Product Guides Dedicated Hosting Reseller Hosting KnowledgeBase Website Email Domain Names Reseller Billing Community Support Browse Questions Ask a Question User Submitted Articles Education Channels Android BoldGrid cPanel DokuWiki Drupal 7 Drupal 8 Everything Email Joomla 2.5 Joomla 3.1 K2 Magento 1.6 Mambo MediaWiki Moodle Movable Type OpenCart OpenCart 2.0 osCommerce PHP-Fusion PHP-Nuke phpBB phpList Premium Website Builder PrestaShop 1.5 PrestaShop 1.6 SMF Tiki Wiki VirtueMart 3 Web Hosting Manager Website Design WordPress Tools & Resources Email Configuration Blacklist Check Visual DNS Lookup Quick Tagger Icon Sets Favicon Generator Bounce Back Parser What is my IP address? >>Website .htaccess (17)Adobe Flash (2)APIs (2)Backup and Restore (15)Billing (8)Browser Issues (2)Connecting to a Database (5)cPanel (26)cPanel Account Management (16)Cron Jobs (4)Cube Cart (2)Database Setup (5)Database Troubleshooting (6)Domain Management (2)Dreamweaver (12)Drush (2)eCommerce (7)Elasticsearch (4)Fantastico (4)File Management (16)File Manager (6)FTP (10)FTP Client Setup (21)General Server Setup / Management (15)Getting Started Guides (18)Ghost (3)Google Tools (21)How To (23)HTML (2)Image Editing (2)IP Addresses (3)iWeb (1)JavaScript (2)Joomla (10)Joomla 2.5 (36)Koken (11)Linux (27)Logaholic (5)Magento (2)Maintaining Your Website (1)Managing Files (7)Microsoft FrontPage (11)Microsoft Publisher (1)ModSecurity (7) MODx (3)New Customers (7)Open Classifieds (1)PCI Compliance (7)PHP (15)PHP Configuration (7)PHP Troubleshooting (6)phpBB (25)phpMyAdmin (10)Premiu