What is the proper way to reconfigure mysql to use only utf-8 charset ?

4 posts / 0 new
Last post
#1 Thu, 08/15/2013 - 07:05
MatthiasL

What is the proper way to reconfigure mysql to use only utf-8 charset ?

I did not find the configuration page for setting mysql to utf8. Please help!

At the moment the mysql system variables are:

character_set_client latin1 character_set_connection latin1 character_set_database latin1 character_set_results latin1 character_set_server latin1 character_set_system utf8

My system: Debian 7-64bit and virtualmin 4.01.gpl

Thu, 08/15/2013 - 17:12
jimdunn

Yes, I've got the same problem!!

Thu, 08/15/2013 - 19:08 (Reply to #2)
lisandi

Check out the following answer to change to utf8

It would be great if virtualmin would simply integrate those utf8 settings by default instead of leading "newbies" to the IMHO weird and old ISO standard of the originally swedish MySQL

Thu, 08/15/2013 - 19:04 (Reply to #3)
lisandi

WEBMIN - FILE MANAGER
on Debian7 it is:

/etc/mysql/my.cnf

FAST / EASY / WORKING

edit it i.e. to this:


#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
open-files-limit  = 32768
log-error  = /var/log/mysql/mysql-error.log

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake

### DO NOT USE IN XCP-XAPI
#local-infile  = 0
#automatic_sp_privileges  = 0
#safe-user-create  = 1
#secure-auth  = 1
###

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 0.0.0.0
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 384M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8

### DO NOT USE IN XCP-XAPI
#interactive_timeout      = 3600
###
wait_timeout             = 6000

tmp_table_size = 32M
max_heap_table_size = 32M

# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 32M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB

innodb_file_per_table = 1

#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

thread_concurrency = 8
thread_cache_size = 256
max_connections = 256

myisam_sort_buffer_size = 64M
read_rnd_buffer_size = 8M
read_buffer_size = 2M

table_definition_cache = 4096
table_open_cache = 16384
table_cache = 1024

sort_buffer_size = 2M

### DO NOT USE IN XCP-XAPI
#thread_stack             = 256K
#join_buffer_size         = 2M
#optimizer_search_depth   = 4
#query_cache_type         = 1
#query_cache_limit        = 256K
#query_cache_size         = 256M
#query_cache_min_res_unit = 4K
###

[mysqldump]
quick
quote-names
max_allowed_packet = 64M

[mysql]
no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 256M

write_buffer = 2M
read_buffer = 2M
sort_buffer_size = 256M

key_cache_block_size = 4K
bulk_insert_buffer_size  = 8M
myisam_sort_buffer_size  = 64M

concurrent_insert        = 2

[innodb]
innodb_buffer_pool_size = 8192M
innodb_log_group_home_dir = /var/lib/mysql
innodb_data_home_dir = /var/lib/mysql

#innodb_autoextend_increment = 128
#innodb_data_file_path = ibdata1:128M:autoextend

innodb_log_buffer_size = 8M
innodb_additional_mem_pool_size = 8M
innodb_flush_log_at_trx_commit  = 0
innodb_file_per_table = 1

#innodb_strict_mode = 1

innodb_thread_concurrency = 16
innodb_lock_wait_timeout = 60

#innodb_support_xa = 0

innodb_flush_method = O_DIRECT
#thread_concurrency = 10

general_log_file = /var/log/mysql/mysql.log
general_log = 1

log_output = FILE

slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log

long_query_time = 1 # 2

server-id                = 1
log_bin                  = /var/log/mysql/mysql-bin.log
binlog_cache_size        = 256K
sync_binlog              = 256
expire_logs_days         = 14
max_binlog_size          = 1G
binlog_do_db             = include_database_name
binlog_ignore_db         = include_database_name

log-bin-trust-function-creators = 1
binlog_format = mixed

#sql-mode ="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

Topic locked