Incorrect string value: ‘\xB8\xDF\xAE\xF9\x80 at row 1
latin1
show create database <数据库名> mysql> show create database information_company; +---------------------+------------------------------------------------------------------------------+ | Database | Create Database | +---------------------+------------------------------------------------------------------------------+ | information_company | CREATE DATABASE `information_company` /*!40100 DEFAULT CHARACTER SET latin1 */ | +---------------------+------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
alter database <数据库名> character set utf8; mysql> alter database information_company character set utf8; Query OK, 1 row affected (0.00 sec)
my.ini
文件my.ini
文件默认是在C:\ProgramData\MySQL\MySQL Server 5.7
[client]
在下面添加default-character-set=utf8mb4
# The following options will be read by MySQL client applications. # Note that only client applications shipped by MySQL are guaranteed # to read this section. If you want your own MySQL client program to # honor these values, you need to specify it as an option during the # MySQL client library initialization. # [client] default-character-set=utf8mb4
[mysqld]
在下面添加character-set-server=utf8mb4
# 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=utf8mb4 # collation-server=utf8_general_ci
然后拷贝一份到我们MySQL的安装目录(默认安装在C:\Program Files\MySQL\MySQL Server 5.7
)
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Qx7veb65-1635473580696)(/picture/安装目录.png)]
最后重启mysql服务
右键此电脑 —> 管理
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DUVrCAOn-1635473580698)(/picture/服务.png)]
在键盘上敲入mysql,找到mysql服务,点击重新启动
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GIjS6DmP-1635473580700)(/picture/重新启动.png)]