Archives

You are currently viewing archive for 29 August 2007
Category: Study
Posted by: hajime osako
The INFORMATION_SCHEMA database has a SCHEMATA table that contains database metadata.

SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'searching database';

The output of the SHOW DATABASES statement depends on whether you have the SHOW DATABASES privilege. It can take a LIKE clause.

SHOW DATABASES LIKE 'm%';

SHOW CREATE DATABASE shows the CREATE DATABASE statement.
Category: Study
Posted by: hajime osako
Each database directory has a default character set and collation. The properties are stored in a file named db.opt in the database directory.
MySQL does not place any limits on the number of databases.
In MySQL, the word "database" is same as "schema". So "SHOW SCHEMAS" instead of "SHOW DATABASES" is doable.

The CREATE/ALTER DATABASE statements have two optional clauses, CHARACTER SET and COLLATE.
Example:
CREATE DATABASE database_name CHARACTER SET utf8 COLLATE utf8_japanese_ci;
ALTER DATABASE (database_name) CHARACTER SET latin1 COLLATE latin1_swedish_ci;

ALTER DATABASE affects only creation of new tables. You cannot use ALTER DATABASE to rename a database.

Any warning generated when IF EXISTS is used can be displayed with SHOW WARNINGS.
Category: Web dev
Posted by: hajime osako