Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Problems with Mysql file (1046 - No database selected)

Error SQL query:


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)