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

Databases

Filipe Pacheco
seal-mask
.a{fill-rule:evenodd;}techdegree
Filipe Pacheco
Full Stack JavaScript Techdegree Student 21,416 Points

Error Code: 1006. Can't create database

I'm trying to create a database on workbench, but I keep getting this message. Tried searching in google, but they all give complicated terminal commands that I don't how to use in this situation. What can I do?

Steven Parker
Steven Parker
231,261 Points

What's your DDL look like?

3 Answers

Andrew Winkler
Andrew Winkler
37,739 Points

You're using MySQL, correct? If you're using the command line you can use:

CREATE DATABASE your_database_name;

Then to use the database:

USE your_database_name;

Then you can create a table:

 CREATE TABLE your_table (
     id bigint unsigned PRIMARY KEY auto_increment,
     name varchar(50) NOT NULL,
     description text,
     modified_on timestamp
 ) ENGINE = InnoDB;

Then you can populate the table:

INSERT INTO your_table (name, description) 
VALUES ('Filipe', 'You are awesome');

Then you can select your table to do stuff:

 SELECT * FROM your_table;

If commands do not work, something has been configured improperly. In that case I'd advise searching for a beginner YouTube video featuring a step-by-step walk through of how to get things going.