Re: Need help to modify 'character_set_database'
Posted by: Rick James
Date: April 03, 2011 05:08PM

Quote

The character set and collation for the default database can be determined from the values of the character_set_database and collation_database system variables. The server sets these variables whenever the default database changes. If there is no default database, the variables have the same value as the corresponding server-level system variables, character_set_server and collation_server.
-- http://dev.mysql.com/doc/refman/5.1/en/charset-database.html

That is, you don't. Instead it is a 'readonly' value that comes from elsewhere. Example:
mysql> CREATE DATABASE db_utf8 DEFAULT CHARACTER SET = utf8;
Query OK, 1 row affected (0.07 sec)

mysql> CREATE DATABASE db_latin1 DEFAULT CHARACTER SET = latin1;
Query OK, 1 row affected (0.01 sec)

mysql> USE db_utf8;
Database changed
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+-----------------------------------------------+
| Variable_name            | Value                                         |
+--------------------------+-----------------------------------------------+
| character_set_client     | latin1                                        |
| character_set_connection | latin1                                        |
| character_set_database   | utf8                                          |
| character_set_filesystem | binary                                        |
| character_set_results    | latin1                                        |
| character_set_server     | utf8                                          |
| character_set_system     | utf8                                          |
| character_sets_dir       | ... |
+--------------------------+-----------------------------------------------+
8 rows in set (0.00 sec)

mysql> USE db_latin1;
Database changed
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+-----------------------------------------------+
| Variable_name            | Value                                         |
+--------------------------+-----------------------------------------------+
| character_set_client     | latin1                                        |
| character_set_connection | latin1                                        |
| character_set_database   | latin1                                        |
| character_set_filesystem | binary                                        |
| character_set_results    | latin1                                        |
| character_set_server     | utf8                                          |
| character_set_system     | utf8                                          |
| character_sets_dir       | ... |
+--------------------------+-----------------------------------------------+
8 rows in set (0.00 sec)

Why do you think you want to set it?

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Need help to modify 'character_set_database'
4937
April 03, 2011 05:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.