Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What about the mysql garbled code in ubuntu

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the ubuntu mysql garbled code how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian with you to understand.

Solutions to ubuntu mysql garbled: 1, find client and add "default-character-set=utf8"; 2, find mysqld_safe and add "default-character-set=utf8"; 3, restart mysql.

This article operating environment: ubuntu 16.04system, mysql5.5 version, Dell G3 computer.

Resolve Chinese garbled code in MySQL in Ubuntu:

1. Log in as root and enter the command sudo gedit / etc/mysql/my.cnf at the terminal in the open file

Find [client] and add below

Default-character-set=utf8

Find [mysqld_safe] and add below

Default-character-set=utf8

Find [mysqld] and join below, after 12.04,

Character-set-server=utf8init_connect='SET NAMES utf8'

Or before 12.04

Default-character-set=utf8init_connect='SET NAMES utf8'

Find [mysql] and add below

Default-character-set=utf8

two。 Restart the mysql command for your above changes to take effect

Deactivate command: sudo mysqladmin shutdown-u root-p

Enable command: sudo / etc/init.d/mysql restart

Or: sudo mysqld_safe-user=mysql &

3. Check the current mysql code.

Enter the mysql command: sudo mysql-u root-p

Check the mysql character set command: show variables like 'character%'

+-- +-- + | Variable_name | Value | +-- +-- + | character _ set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | character_set_results | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-+-+

4. The original library and table can not take effect, or garbled, but the new one can display Chinese normally!

Thank you for reading this article carefully. I hope the article "what to do about mysql garbled in ubuntu" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report