Error Number 1046 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 company Business no database selected mysql Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation
#1046 - No Database Selected Import
Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like no database selected php 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: `work` -- -- no database selected codeigniter -------------------------------------------------------- -- -- 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 199k36356415 asked Oct 23 '10 at 18:19 steph 687253 5 In case
No Database Selected Mysql Workbench Import
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 213 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,986946102 answered Oct 23 '10 at 18:21 codaddict 251k50362443 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 o
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 error 1046 (3d000) no database selected grant Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs no database selected mysql command line Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers,
No Database Selected Mysqli
just like you, helping each other. Join them; it only takes a minute: Sign up 1046: No database selected? up vote -1 down vote favorite I am having a problem. The below code, I clearly select a http://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve database, however it still gives me an error stating I didn't. Can anyone let me know what I am doing wrong? php mysql http://stackoverflow.com/questions/16539621/1046-no-database-selected sql mysqli share|improve this question asked May 14 '13 at 9:31 Natasha Harrell 115 Please see: Why is $foo[bar] wrong? php.net/manual/en/language.types.array.php (A puppy dies when you do this) –Waygood May 14 '13 at 9:54 add a comment| 5 Answers 5 active oldest votes up vote 4 down vote accepted You've misspelled your connection resource variable here: mysqli_select_db($sc, "264191"); Should be mysqli_select_db($nc, "264191"); mysqli_connect also allows you to specify your database as the 4th parameter, making the above line redundant: $nc = mysqli_connect("localhost", "264191", "adhiambo95", "264191"); Try it out. One more thing, pointed out first by Yogesh Suthar, your SQL query is wrong, you have a period where you shouldn't: $sis = "INSERT INTO nogata_keywords ('keyword') VALUE ('.$_GET[keyword]')"; Should be $sis = "INSERT INTO nogata_keywords (`keyword`) VALUE ('".$nc->real_escape_string($_GET['keyword'])."')"; Because you have quoted the field name in single quotes and not escaped the value to be inserted into the database. ie if keyword was O'Neil this would invalidate the SQL. Consider switching to using prepare() and bind() to avoid this issue. You should also use 'keyword' as in index to the $_GET array not just keyword which is actually a constant. http://php.net/manual/en/language.types.array.php share|improve this answer edited May 14 '13 at 10:13 answered May 14 '13 at 9:33 George 27.6k73265 You should fix OP's SQL for a complete answer –Wayg
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 möchte sie behalten Rückgängig machen Schließen Dieses Video ist nicht verfügbar. WiedergabelisteWarteschlangeWiedergabelisteWarteschlange https://www.youtube.com/watch?v=ZciWnmcf7fU Alle entfernenBeenden Wird geladen... Wiedergabeliste Warteschlange __count__/__total__ Fix #1046 - No database selected itcs program AbonnierenAbonniertAbo beenden271271 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 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 no database 23.014 Aufrufe 74 Dieses Video gefällt dir? Melde dich bei YouTube an, damit dein Feedback gezählt wird. Anmelden 75 7 Dieses Video gefällt dir nicht? Melde dich 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 no database selected 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 656.101 Aufrufe 8:50 1046 Error in SQL In phpMyAdmin[Solved] - Dauer: 1:34 Zaroon bin hadi 360 Aufrufe 1:34 How to Fix No Database Selected Problem in MySQL - Dauer: 1:54 Codescoder Program 758 Aufrufe 1:54 IMPORTAR EXPORTAR BASE DATOS SQL PHPMYADMIN - Dauer: 8:00 APRENDIZ WEBMASTER 7.940 Aufrufe 8:00 SERVIDOR WEB CON XAMPP CONFIGURACION DEL PUERTO 80 - Dauer: 15:12 Jose Muñoz 17.600 Aufrufe 15:12 "No Database Selected" Error During The SQL File Import - Dauer: 1:44 TemplateMonsterCo 3.040 Aufrufe 1:44 Error 1064 when restoring a mysql dump - Dauer: 1:20 Adarsh Agarwal 542 Aufrufe 1:20 "Error Establishing a Database Connection" -- How to Fix This WordPress Error: Part 1 of 2 - Dauer: 5:38 kentuckyclassroom 213.307 Aufrufe 5:38 how to import and export data base in