时间:2021-07-01 10:21:17 帮助过:4人阅读
第一种:
建表时加charset utf8mb4:create database ya charset utf8mb4
第二种:
把编码改为可识别中文:
mysql> show variables like ‘%character%‘;
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | utf8 |
| character_set_filesystem | utf8 |
| character_set_results | gbk |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | C:\mysql-5.6.45-winx64\share\charsets\ |
+--------------------------+----------------------------------------+
格式 set character_set_database=utf8;
第三种:更改配置文件my.in
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld]
# 设置mysql的安装目录 **后面的路径一定是安装sql的目录(自己电脑的)**
basedir=C:\mysql-5.6.45-winx64
# 设置mysql数据库的数据的存放目录,必须是data
datadir=C:\mysql-5.6.45-winx64\data
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# mysql端口
port=3306
# 字符集
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
mysql编写中文时变成问号解决方法
标签:database def 字符 mysql的安装 tables val 编写 mysql数据库 har