Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 1046 - No database selected

Status
Not open for further replies.

ShamaJamms

Programmer
Mar 28, 2007
11
I ran the following code in my Windows terminal, and got the error: Error 1046 - No database selected:

CREATE TABLE `database` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;

Google didn't answer my question.
Thanks.
 
At the command prompt, you must first select a database:

mysql> use DATABASE
Datbase changed
mysql> CREATE TABLE `database` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;

Try that using your database name, of course. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top