Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
63 views2 pages

In In:: (Database - ... (Database

The ALTER DATABASE statement enables changing a database's overall characteristics stored in the db.opt file, such as the default character set and collation. It can also upgrade the data directory name encoding for databases created with older MySQL versions. ALTER SCHEMA is a synonym for ALTER DATABASE. The CHARACTER SET and COLLATE clauses change the default character set and collation, respectively. Stored routines may need recreating if the defaults change. The UPGRADE DATA DIRECTORY NAME clause updates directory names for older databases to the encoding used from MySQL 5.1 onwards.

Uploaded by

Irwan Bros
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

In In:: (Database - ... (Database

The ALTER DATABASE statement enables changing a database's overall characteristics stored in the db.opt file, such as the default character set and collation. It can also upgrade the data directory name encoding for databases created with older MySQL versions. ALTER SCHEMA is a synonym for ALTER DATABASE. The CHARACTER SET and COLLATE clauses change the default character set and collation, respectively. Stored routines may need recreating if the defaults change. The UPGRADE DATA DIRECTORY NAME clause updates directory names for older databases to the encoding used from MySQL 5.1 onwards.

Uploaded by

Irwan Bros
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Syntax:

ALTER {DATABASE | SCHEMA} [db_name]


alter_specification ...
ALTER {DATABASE | SCHEMA} db_name
UPGRADE DATA DIRECTORY NAME
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. ALTER SCHEMA is a synonym for ALTER DATABASE.
The database name can be omitted from the first syntax, in which case
the statement applies to the default database.
National Language Characteristics
The CHARACTER SET clause changes the default database character set.
The COLLATE clause changes the default database collation.
http://dev.mysql.com/doc/refman/5.5/en/charset.html, discusses
character set and collation names.
You can see what character sets and collations are available using,
respectively, the SHOW CHARACTER SET and SHOW COLLATION statements. See
[HELP SHOW CHARACTER SET], and [HELP SHOW COLLATION], for more
information.
If you change the default character set or collation for a database,
stored routines that use the database defaults must be dropped and
recreated so that they use the new defaults. (In a stored routine,
variables with character data types use the database defaults if the
character set or collation are not specified explicitly. See [HELP
CREATE PROCEDURE].)
Upgrading from Versions Older than MySQL 5.1
The syntax that includes the UPGRADE DATA DIRECTORY NAME clause updates
the name of the directory associated with the database to use the
encoding implemented in MySQL 5.1 for mapping database names to
database directory names (see
http://dev.mysql.com/doc/refman/5.5/en/identifier-mapping.html). This
clause is for use under these conditions:
o It is intended when upgrading MySQL to 5.1 or later from older
versions.
o It is intended to update a database directory name to the current
encoding format if the name contains special characters that need
encoding.
o The statement is used by mysqlcheck (as invoked by mysql_upgrade).
For example, if a database in MySQL 5.0 has the name a-b-c, the name
contains instances of the - (dash) character. In MySQL 5.0, the
database directory is also named a-b-c, which is not necessarily safe
for all file systems. In MySQL 5.1 and later, the same database name is
encoded as a@002db@002dc to produce a file system-neutral directory
name.
When a MySQL installation is upgraded to MySQL 5.1 or later from an
older version,the server displays a name such as a-b-c (which is in the

old format) as #mysql50#a-b-c, and you must refer to the name using the
#mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to
explicitly tell the server to re-encode the database directory name to
the current encoding format:
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
After executing this statement, you can refer to the database as a-b-c
without the special #mysql50# prefix.
URL: http://dev.mysql.com/doc/refman/5.5/en/alter-database.html

You might also like