I downloaded a MySQL backup file and promptly imported into MAMP's phpMyAdmin. I got this return:
Error
SQL query:
--
-- Database: `mysql`
--
-- --------------------------------------------------------
--
-- Table structure for table `columns_priv`
--
CREATE TABLE IF NOT EXISTS `columns_priv` (
`Host` CHAR( 60 ) COLLATE utf8_bin NOT NULL DEFAULT '',
`Db` CHAR( 64 ) COLLATE utf8_bin NOT NULL DEFAULT '',
`User` CHAR( 16 ) COLLATE utf8_bin NOT NULL DEFAULT '',
`Table_name` CHAR( 64 ) COLLATE utf8_bin NOT NULL DEFAULT '',
`Column_name` CHAR( 64 ) COLLATE utf8_bin NOT NULL DEFAULT '',
`Timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
`Column_priv` SET( 'Select', 'Insert', 'Update', 'References' ) CHARACTER SET utf8 NOT NULL DEFAULT '',
PRIMARY KEY ( `Host` , `Db` , `User` , `Table_name` , `Column_name` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin COMMENT = 'Column privileges';
MySQL said:
#1046 - No database selected
I did not alter the .sql file at all. Any hints on how i can get this puppy going locally?
Thanks!
If the error arises due to not selecting a database, you can easily overcome it by replacing [database_name] with the correct database name in your server. When creating a table statement from the MySQL workbench, you need to select the database to run before executing the statement.
If you have multiple xampp applications setup then it's possible it might be on a different phpmyadmin instance. If you are indeed only using the one xampp instance then technically it should show in the phpmyadmin area, unless it's configured in such a way that it's not showing…
Error 1046 occurs when we miss to connect our table with a database. In this case, we don't have any database and that's why at first we will create a new database and then will instruct to use that database for the created table.
Navigate to your control panel and click the phpMyAdmin icon. Locate the database you want to search by clicking on the database in the left column. Once inside the database, a list of tables will be displayed.
In phpMyAdmin make a new database or select a existed database. Then import the SQL file.
Just create a database with some name first of all. Click on that database and then import your table. The problem here is when you import any table it looks for which database you are using. So, either do as I said above or add this just above CREATE TABLE IF NOT EXISTS columns_priv
(
USE your_db_name;//here your_db_name is the database you just created.
That's it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With