mysql中文显示'???'乱码问题

一、配置my.ini

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[client]
default-character-set=utf8

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

 

# These are commonly set, remove the # and set as required.
basedir = C:\gyd_work\mysql\mysql-5.6.40-winx64
datadir = C:\gyd_work\mysql\mysql-5.6.40-winx64\data
# port = .....
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

注意要将my-default.ini删掉

二、重启mysql服务

net stop mysql

net start mysql

三、登入mysql 

mysql -u root -p

四、查看编码

show variables like 'char%';


五、查看原有表编码

show create table springdatajpa.user(数据库名.表名);

六、改变原有表编码

alter table springdatajpa.user convert to character set utf8 collate utf8_general_ci;

之后再执行

show create table springdatajpa.user(数据库名.表名);

看是否有变化


参考:

https://www.cnblogs.com/houqi/p/5713176.html



猜你喜欢

转载自blog.csdn.net/dongyuguoai/article/details/81023294
今日推荐