PDA

View Full Version : [ubuntu] mySQL Error 1046 No Database Selected


kmeth187
September 11th, 2008, 04:13 PM
Im new to linux and mySQL in installed mySQL on ubuntu and when I went to the terminal and started mySQL I tried to create a talbe. For example if I type the following:

CREATE TABLE books (
title_id INT NOT NULL AUTO_INCREMENT,
title VARCHAR (150),
pages INT,
PRIMARY KEY (title_id));

I get the following back:

ERROR 1046 (3D000): No database selected

cariboo907
September 11th, 2008, 11:00 PM
You need to create a database before you can create a table. In the mysql console type:

create database <databasename>;

then

use <databasename>;

Where <databasename> is the name of your database.

Jim