Reputation: 703
Created database in cpanel > mysql database but when I am importing sql file in phpmyadmin I am getting this error
Error
SQL query:
--
-- Database: `alphanationalfire`
--
-- --------------------------------------------------------
--
-- Table structure for table `access`
--
CREATE TABLE IF NOT EXISTS `access` (
`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
And there is no database to select. how to tackle this?
Upvotes: 3
Views: 1155
Reputation: 572
Before creating table, we have to say in which database you are going to create that table. The message 'No Database selected shows' that 'u didnt select the database' so first select database using use databasename
. Then create table.
show databases
command will show the database list created in your mysql. Check whether the table 'alphanationalfire' exists.
In phpmyadmin, check whether it lists the 'alphanationalfire' db name. Then select it ,then try ur work
Upvotes: 0
Reputation: 15
In order to add data to a database from a file you need to have created the databse first. In this case create alphanationalfire then select databse in phpmyadmin and import sql file.
Upvotes: 0
Reputation: 2436
First of all create database in phpmyadmin. Then from the left panel select the database which you create. after opening the database then import your SQL file.
Upvotes: 2