Mysql Error 1046 No Database
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 Learn #1046 - no database selected import more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags no database selected mysql php Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like no database selected mysql workbench import you, helping each other. Join them; it only takes a minute: Sign up Error #1046 - No database selected SQL import on XAMPP up vote 15 down vote favorite 2 I am trying to import the SQL database error 1046 (3d000) no database selected grant from my Drupal production site into a sandbox testing site on my local machine. I currently use XAMPP on my machine here at work. I have downloaded my db aipiadxxm_if9DHdr.sql and then I go to the phpMyAdmin on http://localhost/phpmyadmin/index.php then to -> Import. After I import the db I get this Error: SQL query: -- -- Database: `aipiadxxm_if9DHdr.sql` -- -- -------------------------------------------------------- -- -- Table structure for table `if9d_access` -- CREATE TABLE IF NOT EXISTS `if9d_access` (
#1046 - No Database Selected Wordpress
`aid` int( 11 ) NOT NULL AUTO_INCREMENT , `mask` varchar( 255 ) NOT NULL default '', `type` varchar( 255 ) NOT NULL default '', `status` tinyint( 4 ) NOT NULL default '0', PRIMARY KEY ( `aid` ) ) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1; MySQL said: Documentation #1046 - No database selected What is causing this error message: #1046 - No database selected ? mysql sql drupal phpmyadmin xampp share|improve this question edited Aug 12 '13 at 1:33 Eric Leschinski 47k23221190 asked Jul 11 '12 at 17:46 accraze 54851034 1 It looks like the .sql file is just the table. Try creating the database in phpmyadmin, then importing the file as a table. –PeaBucket Jul 11 '12 at 18:14 add a comment| 1 Answer 1 active oldest votes up vote 37 down vote accepted You need to create and/or select the database on your sandbox machine before importing the SQL for the table structure and data. In phpMyAdmin, this means choosing a database from the sidebar and then using its import tab. If the database you want to fill doesn't exist, you have to create it first using the Create new database form. After import, you should confirm that the export-import process hasn't affected the anonymous user record (uid 0). share|improve this answer answered Jul 11 '12 at 18:33 scronide 7,
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
No Database Selected Mysql Command Line
this site About Us Learn more about Stack Overflow the company Business no database selected mysqli Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask error code 1046 in mysql workbench Question x Dismiss 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 http://stackoverflow.com/questions/11438427/error-1046-no-database-selected-sql-import-on-xampp up phpMyadmin database import error #1046 - No database selected up vote 6 down vote favorite 2 I have an sql file that i exported from phpmyadmin on another computer. I tried to import the file on this computer and I get this error: Error SQL query: -- -- Database: `phplogin` -- -- -------------------------------------------------------- -- -- Table structure for table `people` -- CREATE http://stackoverflow.com/questions/6880511/phpmyadmin-database-import-error-1046-no-database-selected TABLE IF NOT EXISTS `people` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `name` VARCHAR( 25 ) NOT NULL , `age` INT( 11 ) NOT NULL , `testvar` VARCHAR( 5 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =3; MySQL said: #1046 - No database selected mysql database import phpmyadmin share|improve this question edited Dec 23 '14 at 16:00 default locale 6,50692947 asked Jul 30 '11 at 1:31 user780483 71181527 add a comment| 2 Answers 2 active oldest votes up vote 29 down vote The error is because you either didn't select a database on the left side to import to, and/or you didn't create the empty database first. Create a database in phpMyAdmin called "phplogin", select it on the left side, and then run the import. share|improve this answer answered Aug 3 '11 at 0:17 Clowerweb 841912 3 Any idea how to do this in a phpMyAdmin configuration that only logs into a specific database? (Thus there is no DB to select on the left, only tables.) –Old McStopher Jun 19 '14 at 1:0
"#1046: No database selected" error when trying to import a .sql file in phpMyAdmin. Solution #1: Before importing In phpMyAdmin, click on the Export tab from the home page of phpMyAdmin, without http://wisercoder.com/how-to-fix-the-1046-no-database-selected-error-in-phpmyadmin/ selecting any database. phpMyAdmin will then include instructions to create and select the database when you import it. This solution does not apply to most shared hosts, since they won't allow you to create a database from phpMyAdmin. Solution #2: The alternative fix Unlike solution #1, this one also works on shared hosts. Create the new database on your server, then write down the name. Open your .sql file with a text no database editor Insert the following line right before the first CREATE TABLE instruction in your .sql file: USE your_database_name_here; Save your file, then import it in phpMyAdmin. SQL Tagged database, errors, mysql, phpmyadmin, sql ← How to get an Integer from a Java resultset How to properly validate email addresses in Java → 21 comments on “How to fix the "#1046: No database selected" error in phpMyAdmin” carle November 13, 2013 at 11:34 no database selected pm many thanks! save my life! Reply Sam June 3, 2014 at 2:08 pm What i get when i export my database is a notepad file format showing mywebname.sql instead of the normal sql file for upload to liveserver….please help as i dont know what could be wrong. Reply Nicolas Bouliane June 3, 2014 at 3:05 pm Upload that file in the import form Reply Manish Atri November 19, 2013 at 7:43 am Thanks a lot Buddy Reply Juanita Alcachofa December 5, 2013 at 6:32 pm Muy bueno, me sirvió. Reply Ivan January 3, 2014 at 11:07 pm Thank you! Solution #2 worked for me! Reply Pizo January 13, 2014 at 10:41 pm Thank you! Reply Mr January 21, 2014 at 11:54 pm Just wanted to add, since your solution led me to the answer : It's all because there is an existing database of the hosting company and they won't allow you to open one yourself, but rather suit yours into theirs. The solution therefore is to 1.export your database in sql format from phpmyadmin localhost 2.open that file with notepad++ 3.edit the first lines to this CREATE DATABASE IF NOT EXISTS hosting_db01 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE hosting_db01; where ‘hosting_db01′ is the n