Altering a Database

The ALTER DATABASE statement enables you to change the characteristics of an existing database. Its syntax is the same as the syntax of the CREATE DATABASE statement, and any CHARACTER SET or COLLATE specification changes the behavior of an existing database.

For example, suppose you want to change greekdb to use the ASCII character set. You would issue the following command:

mysql> ALTER DATABASE greekdb
    -> CHARACTER SET ascii;
Query OK, 1 row affected (0.00 sec)

Get Sams Teach Yourself MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.