Ubuntu to change the MySQL default character set

Source: Internet
Author: User

Installing MySQL server in Ubuntu is simpler, and a single command can be done as follows:

sudo apt-get install Mysql-server

However, installing MySQL with Apt-get can not set the default character set, may be I do not understand how to do, install the default character set is Latin1, you can log on to MySQL after the status command to view, the display reads as follows:

root@ubuntu-vm:/home/kuuyee# Mysql-u Root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 4
Server version:5.0.51a-3ubuntu5.4 (Ubuntu)

Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the buffer.

mysql> status
--------------
MySQL Ver 14.12 distrib 5.0.51a, for Debian-linux-gnu (i486) using ReadLine 5.2

Connection Id:4
Current database:
Current User:root@localhost
Ssl:not in use
Current Pager:stdout
Using outfile: '
Using delimiter:;
Server version:5.0.51a-3ubuntu5.4 (Ubuntu)
Protocol version:10
Connection:localhost via UNIX socket
Server characterset:latin1
Db characterset:latin1
Client characterset:latin1
Conn. Characterset:latin1
UNIX Socket:/var/run/mysqld/mysqld.sock
Uptime:16 hours sec

Threads:1 questions:10 Slow queries:0 opens:12 Flush tables:1 Open tables:6 queries per second avg:0.000

--------------

The workaround is to change the/etc/mysql/my.cnf file and add the following under [Mysqld] and [MySQL]:

[mysqld]
default-character-set=utf8
default-storage-engine=INNODB

[mysql]
default-character-set=utf8

Then restart the MySQL server, commands are as follows:

Sudo/etc/init.d/mysql restart

Then check the status, hehe! The character set becomes Utf-8!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.