Error 3d000
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
Mysql Error 1046 (3d000) No Database Selected
the company Business Learn more about hiring developers or posting ads with us Stack Overflow no database selected error in php Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of error 1046 (3d000) no database selected grant 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 down vote favorite I am trying to
Error 1046 No Database Selected Phpmyadmin
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 = name then SIGNAL SQLSTATE '45002' SET MESSAGE_TEXT = 'This database
Error Code 1046 In Mysql Workbench
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 accepted Use the :: use database to select the database to which you want the proc to be created or try usi
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 error 1046 (3d000) at line 22: no database selected or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x
No Database Selected Mysql Command Line
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 only no database selected mysqli takes a minute: Sign up ERROR 1046 (3D000): No database selected while creating user up vote 0 down vote favorite When I create a admin user with: GRANT ALL ON * TO my_name@localhost IDENTIFIED BY 'my_passwd' WITH GRANT OPTION I http://stackoverflow.com/questions/17402181/create-procedure-error-1046-3d000-no-database-selected received the error message "ERROR 1046 (3D000): No database selected". mysql mysql-error-1064 share|improve this question edited Nov 19 '14 at 14:12 Lars 1,186823 asked Nov 19 '14 at 13:56 user2823470 312 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted You should be saying it like below by qualifying it with database name. Check MySQL Documentation for more information. GRANT ALL ON db_name.* So for your case, GRANT ALL ON db1.* TO my_name@localhost IDENTIFIED http://stackoverflow.com/questions/27018653/error-1046-3d000-no-database-selected-while-creating-user BY 'my_passwd' WITH GRANT OPTION; share|improve this answer answered Nov 19 '14 at 13:59 Rahul 43.4k63462 or for all databases use GRANT ALL ON *.* ... –Lars Nov 19 '14 at 14:04 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 Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged mysql mysql-error-1064 or ask your own question. asked 1 year ago viewed 6684 times active 1 year ago Related -2Syntax Error in Create Function2Importing using MySQL WorkBench… error ERROR 1046 (3D000)0Error Updating Database with PHP0You have an error in your SQL syntax while doing a basic SELECT0MySQL Error #1064 from Create Table1MySQL Error: #1046 - No database selected-1Create procedure ERROR 1046 (3D000): No database selected-1SQLSTATE[3D000]:1046 - No database selected0SQL syntax error when adding a user to the database through php0codeigniter 3.1 PDO mysql Error Number: 3D000/1046 No database selected Hot Network Questions Can my boss open and use my computer when I'm not present? Is it a fallacy, and if so which, to believe we are special because our existence on Earth seems improbable? Why was Arcanine with the Legendary Birds in Veridian City in Pokémon Origins? Russian babel, lmo
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: https://bugs.mysql.com/bug.php?id=73590 Triage: Needs Triage: D4 (Minor) View Add Comment Files Developer Edit https://bugs.mysql.com/bug.php?id=23413 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 no database 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 no database selected 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
13:34 Reporter: Siu Ching Pong (Asuka Kenji) (Basic Quality Contributor) Email Updates: Status: Duplicate Impact on me: None Category:MySQL Server Severity:S3 (Non-critical) Version:5.0.24a-community-nt OS:Microsoft Windows (Windows XP) Assigned to: Tags: 1046, 3D000, delete, DELETE FROM, ERROR 1046, ERROR 1046 (3D000), No database selected View Add Comment Files Developer Edit Submission View Progress Log Contributions [18 Oct 2006 8:45] Siu Ching Pong (Asuka Kenji) Description: MySQL returns "ERROR 1046 (3D000): No database selected" when executing "DELETE FROM ... USING ..." with table aliases. How to repeat: Execute the following statements in MySQL client: CREATE TABLE test.testA ( colA INT PRIMARY KEY ); CREATE TABLE test.testB ( colB INT PRIMARY KEY, colA INT NOT NULL, CONSTRAINT fk_B_A FOREIGN KEY (colA) REFERENCES test.testA (colA) ); DELETE FROM A, B USING test.testA A JOIN test.testB B ON A.colA = B.colB; ---------------------------------------------------------------- It succeeds if the last statement is changed to: DELETE FROM test.testA, test.testB USING test.testA JOIN test.testB ON test.testA.colA = test.testB.colB; ---------------------------------------------------------------- It also succeeds if "USE test;" is executed first before the last statement. [18 Oct 2006 10:05] Hartmut Holzgraefe verified using 5.0bk [18 Oct 2006 10:11] Hartmut Holzgraefe mysqltest test caseAttachment: bug23413.tgz (application/x-gtar, text), 885 bytes.
[30 Nov 2006 22:36] Konstantin Osipov http://dev.mysql.com/doc/refman/5.0/en/delete.html Note: If you provide an alias for a table, you must use the alias when referring to the table: DELETE t1 FROM test AS t1, test2 WHERE ... Cross-database deletes are supported for multiple-table deletes, but in this case, you must refer to the tables without using aliases. For example: DELETE test1.tmp1, test2.tmp2 FROM test1.tmp1, test2.tmp2 WHERE ... This explanation also applies to the case and hand. [15 Feb 2007 12:34] Sveta Smirnova Bug #26370 was marked as duplicate of this one [27 Jul 2007 13:35] Konstantin Osipov Duplicate of Bug #27525 table not found when using multi-table-deletes with aliases over several databas [11 Jul 20:46] Daniel Fisher This bug does not appear to be fixed perfectly. Consider the following case, in whcih the delete only affects a single table. In this case, MySQL 5.7 still produces a 1046