Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Using PHP with MySQL Using Relationship Tables in MySQL Understanding Relationship Tables

Problems with Mysql file (1046 - No database selected)

Error SQL query:

CREATE TABLE sizes (

id INT( 11 ) NOT NULL AUTO_INCREMENT , size VARCHAR( 32 ) COLLATE utf8_unicode_ci DEFAULT NULL , order INT( 11 ) NOT NULL , PRIMARY KEY ( id ) ) ENGINE = INNODB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT =5;

MySQL said: Documentation

1046 - No database selected

No good, if you get problems just importing a file!

Problem is that I cant write "Create table"

1 Answer

Petros Sordinas
Petros Sordinas
16,181 Points

You have to tell SQL which database you are using

Either : USE database_name; or if the database does not exist CREATE DATABASE database_name USE database_name;

THANKS, I got it to work now...

Oki, my database name is: movikcrewhunter

USE movikcrewhunter; CREATE TABLE sizes ( id int(11)