MySQL 'create schema' and 'create database' - Is there any difference

Bob picture Bob · Aug 2, 2009 · Viewed 163.9k times · Source

Taking a peak into the information_schema database and peaking at the metadata for one of my pet projects, I'm having a hard time understanding what (if any) differences there are between the create schema command and the create database command for MySQL.

Are there any differences? If not, is this a rather typical pattern of behavior for relational databases (I've heard that for other databases, such as Oracle, a schema exists in a database, rather than being on the same level as a database).

Thanks!

Answer

Pascal MARTIN picture Pascal MARTIN · Aug 2, 2009

The documentation of MySQL says :

CREATE DATABASE creates a database with the given name. To use this statement, you need the CREATE privilege for the database. CREATE SCHEMA is a synonym for CREATE DATABASE as of MySQL 5.0.2.

So, it would seem normal that those two instruction do the same.