ALTER DATABASE [db_name
]alter_specification
...alter_specification
: [DEFAULT] CHARACTER SET [=]charset_name
| [DEFAULT] COLLATE [=]collation_name
ALTER DATABASE
enables you to
change the overall characteristics of a database. These
characteristics are stored in the db.opt
file
in the database directory. To use ALTER
DATABASE
, you need the
ALTER
privilege on the database.
The CHARACTER SET
clause changes the default
database character set. The COLLATE
clause
changes the default database collation. Section 9.1, “Character Set Support”,
discusses character set and collation names.
Beginning with MySQL 4.1.0, you can see what character sets and
collations are available using, respectively, the
SHOW CHARACTER SET
and
SHOW COLLATION
statements. See
Section 12.4.5.3, “SHOW CHARACTER SET
Syntax”, and
Section 12.4.5.4, “SHOW COLLATION
Syntax”, for more information.
ALTER DATABASE
was added in MySQL
4.1.1. Beginning with MySQL 4.1.8, the database name can be
omitted, in which case the statement applies to the default
database.
MySQL Enterprise. In a production environment, alteration of a database is not a common occurrence and may indicate a security breach. Advisors provided as part of the MySQL Enterprise Monitor automatically alert you when data definition statements are issued. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
User Comments
Add your own comment.