Difference Between Schema / Database in MySQL

Lloyd Banks picture Lloyd Banks · Jul 23, 2012 · Viewed 212.8k times · Source

Is there a difference between a schema and a database in MySQL? In SQL Server, a database is a higher level container in relation to a schema.

I read that Create Schema and Create Database do essentially the same thing in MySQL, which leads me to believe that schemas and databases are different words for the same objects.

Answer

eggyal picture eggyal · Jul 23, 2012

As defined in the MySQL Glossary:

In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE.

Some other database products draw a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the tables and other objects owned by a single user.