error-1046-no-database-selected-how-to-resolve
error-1046-no-database-selected-how-to-resolve
Error SQL query:
--
-- Database: 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
Solution
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;
Top comments (0)