priya
priya

Reputation: 26689

How to alter the character set on the mysql database

I dumped all character_set_* variables in my MySQL database, since I wanted MySQL to have a 'utf8' character set. But even after using the set names command only few of the variables have changed. Have I configured this correctly?

mysql> SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| 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     | latin1 |
| character_set_system     | utf8   |
+--------------------------+--------+
7 rows in set (0.29 sec)

mysql> set names utf8;
Query OK, 0 rows affected (0.29 sec)

mysql> SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| Variable_name            | Value  |
+--------------------------+--------+
| character_set_client     | utf8   |
| character_set_connection | utf8   |
| character_set_database   | latin1 |
| character_set_filesystem | binary |
| character_set_results    | utf8   |
| character_set_server     | latin1 |
| character_set_system     | utf8   |
+--------------------------+--------+
7 rows in set (0.29 sec)

Upvotes: 0

Views: 334

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

ALTER DATABASE your_db_name CHARACTER SET utf8;

Upvotes: 2

Related Questions