error 1046 3d000 no database selected update user
necessary to give its root password Since i forgot its root password, i ended up with the following error Error: ERROR 1045 (28000): Access denied for user ‘root'@'localhost' (using password: NO) Then i followed the below
Error 1046 3d000 At Line 22 No Database Selected
steps to reset it Steps: 1. [root@venus ~]# service mysqld stop Stopping mysqld: [ OK error 1046 3d000 mysql ] 2. [root@venus ~]# mysqld_safe -skip-grant-tables & [1] 3735 3. [root@venus ~]# 110809 10:43:22 mysqld_safe Logging to ‘/var/log/mysqld.log'. 110809 10:43:22 mysqld_safe StartingNo Database Selected Mysql
mysqld daemon with databases from /var/lib/mysql 4. [root@venus ~]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.56 Source distribution Copyright (c) 2000, #1046 - no database selected phpmyadmin 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type ‘help;' or ‘\h' for help. Type ‘\c' to clear the current input statement. 5. mysql> UPDATE user SET password=PASSWORD("slash123″)WHERE user="root"; ERROR 1046 (3D000): No database selected ( Note: Here "slash123" is my mysql root password ) 6. mysql> show databases; #1046 - no database selected import +-------------+ | Database | +-------------+ | information_schema | | django | | drupal | | mysql | | student | | test | +-------------+ 6 rows in set (0.34 sec) 7. mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with - A Database changed 8. mysql> UPDATE user SET password=PASSWORD("slash123″)WHERE user="root"; Query OK, 3 rows affected (1.07 sec) Rows matched: 3 Changed: 3 Warnings: 0 9. mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) 10. mysql> quit Bye 11. [rajee@venus ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.1.56 Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type ‘help;' or ‘\h' for help. Type ‘\c' to clear the current input statement. That's it🙂 Now i am able to access MySQL prompt from the terminal Like this:Like Loading... Related Posted in Uncategorized | 3 Comments 3 Responses on April 28, 2012 at 8:52 am | Reply How to reset MySQL root password ? « CSS Tips […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
Error 1046 (3d000) No Database Selected Grant
about Stack Overflow the company Business Learn more about hiring developers or posting error code 1046 in mysql workbench ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community StackNo Database Selected Mysql Command Line
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Create procedure ERROR 1046 (3D000): No database selected up vote -1 https://sraji.wordpress.com/2011/08/10/how-to-reset-mysql-root-password/ down vote favorite I am trying to create a simple procedure which would create a new database. complete code which i am trying to run over mysql is : SET @DB_NAME := "mydb"; SET @DB_CREATE:= "CREATE DATABASE "; DELIMITER // drop procedure if exists create_db // create procedure create_db(name TEXT) BEGIN DECLARE temp TEXT; DECLARE user TEXT; SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = name INTO temp; if temp http://stackoverflow.com/questions/17402181/create-procedure-error-1046-3d000-no-database-selected = name then SIGNAL SQLSTATE '45002' SET MESSAGE_TEXT = 'This database already exist'; else SELECT USER() INTO user; SET @s = CONCAT('CREATE DATABASE ', name); PREPARE stmt_create FROM @s; EXECUTE stmt_create; DEALLOCATE PREPARE stmt_create; SET @s = CONCAT('GRANT ALL PRIVILEGES ON ', name, '.* TO ', user, ' WITH GRANT OPTION'); PREPARE stmt_grant FROM @s; EXECUTE stmt_grant; DEALLOCATE PREPARE stmt_grant; END IF; END // DELIMITER ; call create_db(@DB_NAME); I took the help of how do I use a variable in create database statement for creating this procedure. While running this procedure over mysql i am getting error : ERROR 1046 (3D000): No database selected I have googled it a lot but is unable to fix it. While trying different things i tried to execute the above procedure by first executing: mysql> USE mysql; Using that, error is gone. And mysql> show databases; is displaying all the databases along with the newly created database. Could somebody tell me whether using mysql as default database is correct or not. If somebody has another method please tell it to me. mysql mysql-error-1046 share|improve this question asked Jul 1 '13 at 10:23 user2311046 3418 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote aclog 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 http://dba.stackexchange.com/questions/27245/error-1046-mariadb-no-database-selected more about Stack Overflow the company Business Learn more about hiring developers or posting https://bugs.mysql.com/bug.php?id=73590 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 no database ask a question Anybody can answer The best answers are voted up 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 no database selected the grants on it the database wont work. If I use the base the error is different MariaDB [(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 107k15138274 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
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: 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 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 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 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 1046 (3D000): No database selected mysql> update flavian.test1 a JOIN (select * from flavian.test2 b where b.col1=(select c.col1 from flavian.test2 c where c.col1=1 limit 1)) ea JOIN (select sum(e.col2) size1 from flavian.test2 e where e.col1=1) ef set a.col2=ea.col2, a.col3=ef.size1 where a.col1=1 and a.col2=2; Query OK, 0 rows affected [14 Aug 2014 18:35] Sveta Smirnova Thank you for the