tags:

views:

370

answers:

1

I feel like this should be simple but i can't work out how to set the character set when making a db with "mysqladmin create". I thought this would work

mysqladmin -u root db_name --character-set=utf8

leveraging this bit of the mysqladmin --help text:

-O, --set-variable=name Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.

i also tried this

mysqladmin -u root create db_name --default-character-set=utf8

In both cases, the db was created without complaint, but i don't think it's worked:

mysql> SHOW VARIABLES like '%character%';
+--------------------------+----------------------------+
| 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                       | 
| character_sets_dir       | /usr/share/mysql/charsets/ | 
+--------------------------+----------------------------+

I can see that character_set_system is utf8, but should all of the latin1's above be showing utf8?

Grateful for any advice - max

A: 

No, the variables that you have displayed are the options of your connection, not the database. If you make a database dump, you will see, that everything is in place. For more options see SET NAMES 'charset' command in MySQL Manual.

dma_k
ah...clearly i have some things to learn. thanks!
Max Williams