Error Code 1046 Sqlstate 3d000 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 site About Us Learn more about Stack Overflow the mysql error 1046 3d000 no database selected company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions error 1046 3d000 at line 22 no database selected Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million error 1046 no database selected mysql workbench programmers, 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 136 down vote favorite 22 Error SQL query: -- -- Database:
#1046 - No Database Selected Import
`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 198k36356415 asked Oct 23 '10 at 18:19 steph no database selected php 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 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
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 error 1046 (3d000) no database selected grant Learn more about Stack Overflow the company Business Learn more about hiring developers
No Database Selected Mysql Workbench Import
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack
No Database Selected Mysql Command Line
Overflow Community Stack 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 http://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve selected up vote -1 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 http://stackoverflow.com/questions/17402181/create-procedure-error-1046-3d000-no-database-selected = name INTO temp; if temp = 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 comm
Du siehst YouTube auf Deutsch. Du kannst diese Einstellung unten ändern. Learn more You're viewing YouTube in German. You can change this preference below. Schließen Ja, ich https://www.youtube.com/watch?v=ZciWnmcf7fU möchte sie behalten Rückgängig machen Schließen Dieses Video ist nicht verfügbar. WiedergabelisteWarteschlangeWiedergabelisteWarteschlange Alle entfernenBeenden Wird geladen... Wiedergabeliste Warteschlange __count__/__total__ Fix #1046 - No database selected itcs https://datatables.net/forums/discussion/22604/server-side-example-invalid-catalog-name-1046-no-database-selected program AbonnierenAbonniertAbo beenden269269 Wird geladen... Wird geladen... Wird verarbeitet... Hinzufügen Möchtest du dieses Video später noch einmal ansehen? Wenn du bei YouTube angemeldet bist, kannst no database du dieses Video zu einer Playlist hinzufügen. Anmelden Teilen Mehr Melden Möchtest du dieses Video melden? Melde dich an, um unangemessene Inhalte zu melden. Anmelden 22.769 Aufrufe 73 Dieses Video gefällt dir? Melde dich bei YouTube an, damit dein Feedback gezählt wird. Anmelden 74 7 Dieses Video gefällt dir nicht? Melde dich no database selected bei YouTube an, damit dein Feedback gezählt wird. Anmelden 8 Wird geladen... Wird geladen... Wird geladen... Die Bewertungsfunktion ist nach Ausleihen des Videos verfügbar. Diese Funktion ist zurzeit nicht verfügbar. Bitte versuche es später erneut. Veröffentlicht am 24.04.2015how to fix ERROR : #1046 - No database selected MySQL said: Documentation#1046 - No database selected Kategorie Gaming Lizenz Standard-YouTube-Lizenz Mehr anzeigen Weniger anzeigen Wird geladen... Anzeige Autoplay Wenn Autoplay aktiviert ist, wird die Wiedergabe automatisch mit einem der aktuellen Videovorschläge fortgesetzt. Nächstes Video MySQL Tutorial for Beginners - 1 - Creating a Database and Adding Tables to it - Dauer: 8:50 primetubervideos 653.364 Aufrufe 8:50 1046 Error in SQL In phpMyAdmin[Solved] - Dauer: 1:34 Zaroon bin hadi 254 Aufrufe 1:34 IMPORTAR EXPORTAR BASE DATOS SQL PHPMYADMIN - Dauer: 8:00 APRENDIZ WEBMASTER 7.940 Aufrufe 8:00 How to Fix No Database Selected Problem in MySQL - Dauer: 1:54 Codescoder Program 758 Aufrufe 1:54 SERVIDOR WEB CON X
example, Invalid catalog name: 1046 No database selected matt_riley Posts: 7Questions: 1Answers: 0 July 2014 edited July 2014 in Free community support I'm trying to work with the "simple.html" file in the server side processing examples (http://datatables.net/examples/server_side/simple.html) and getting the error: {"error":"An SQL error occurred: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected"} I've made sure the paths are correct for my server for the files simple.html references (namely, scripts/server_processing.php). I also edited the file that server_processing.php requires, ssp.class.php to connect to my test database. If I load the server_processing.php, I get the aforementioned error. However, if I echo the $sql variable for the sql query it is using, it produces a valid query that runs fine in an app that deals directly with the mysql database: SELECT SQL_CALC_FOUND_ROWS first_name, last_name, position, office, start_date, salary FROM datatables_demo I'm at a loss as to why this won't work. I've loaded the mysql.sql file into a new database with only the table it generates in it (datatables_demo) and, as I said, the query being produced returns correct results when dealing with the database directly. I edited the ssp.class.php file to connect to my database like so: static function sql_connect ( $sql_details ) { try { $db = @new PDO( "mysql:host={$sql_details['localhost']};dbname={$sql_details['dttest']}", $sql_details['testuser'], $sql_details['testpass'], array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ) ); } catch (PDOException $e) { self::fatal( "An error occurred while connecting to the database. ". "The error reported by the server was: ".$e->getMessage() ); } return $db; } However, the error being returned when loading the page is from the sql_exec function part of the file, so does that mean it is actually connecting to the database correctly but the error is happening elsewhere? W