Discuss in Forum
The statement ‘SHOW CREATE DATABASE’ is invoked to see the definition of an existing database in the MySQL server. It is followed by the qualified name of the database.
The file named ‘db.opt’ is of a great significance to MySQL, espectially the MySQL server. It stores the database attributes along with the db charset and collation attributes.
When a database is created, the ‘CHARACTER SET’ and ‘COLLATE’ values are specified. When ‘CHARACTER SET’ is given without ‘COLLATE’, the default collation is used.
The ‘CREATE DATABASE’ statement supports many optional values. To create a database named ‘my_db’ only if it doesn’t already exist, we write ‘CREATE DATABASE IF NOT EXISTS my_db’.
Whenever a database is created in MySQL, the MySQL server creates a directory with the same name as the database. It creates the file db.opt to store the attributes.