解决linux下mysql乱码问题

1、修改/etc/my.cnf文件,增加以下几行:

[client]

# pipe=

# socket=MYSQL

port=3306
default-character-set=utf8
[mysql]
no-beep

# default-character-set=
default-character-set=utf8

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
# server_type=3
[mysqld]
character_set_server=utf8

2、重启mysql服务:

service mysql stop;

service mysql status;

service mysql start;

或者 service mysql restart;

猜你喜欢

转载自blog.csdn.net/daqiang012/article/details/82658243