Configuring MySQL encoding in Ubuntu

Source: Internet
Author: User

Find configuration file

I installed it through sudo apt-get install MySQL. MySQL configuration file in/etc/mysql/my.cnf

If this file is not found, you can run sudo find/-iname ' *.cnf ' to locate all CNF files

Modify configuration file

Add under [mysqld]


Add under [client]


Restart MySQL

sudo service MySQL restart

Log in to MySQL to see if it's successful

# mysql-u Root

Mysql> show VARIABLES like ' char% ';


| variable_name | VALUE |


| character_set_client | UTF8 |

| character_set_connection | UTF8 |

| Character_set_database | UTF8 |

| Character_set_filesystem | BINARY |

| Character_set_results | UTF8 |

| Character_set_server | UTF8 |

| Character_set_system | UTF8 |

| Character_sets_dir | /usr/share/mysql/charsets/|


8 ROWS in SET (0.00 sec)

Restart MySQL

Depending on how you install MySQL, use the unused commands to reboot your MySQL. If you have configured to use the Mysqld self-boot method, you can perform

#/etc/rc.d/init.d/mysql Restart

to reboot.

Or if you configure MySQL as a system service, you can perform

# service MySQL Restert

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.