Difference Between Schema / Database in MySQL
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.
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.
Depends on the database server. MySQL
doesn't care, its basically the same thing.
Oracle
, DB2
, and other enterprise level database solutions make a distinction. Usually a schema is a collection of tables and a Database is a collection of schemas.
Refering to MySql documentation,
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.
链接地址: http://www.djcxy.com/p/38040.html下一篇: MySQL中的模式/数据库之间的区别