关于若依框架后台数据库中文乱码 MySQL8.0 中文乱码

-- 查看字符集编码设置为以下
show VARIABLES like 'CHARACTER%'

set character_set_results = utf8mb4;

character_set_client	utf8mb4
character_set_connection	utf8mb4
character_set_database	utf8mb4
character_set_filesystem	binary
character_set_results	utf8mb4
character_set_server	utf8mb4
character_set_system	utf8mb3
character_sets_dir	E:\mysql8.0\mysql-8.0.31-winx64\share\charsets\

  遇到中文乱码是就可以使用以下SQL修改表的字符集编码,解决

SELECT
CONCAT("ALTER TABLE `", TABLE_NAME,"` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;")
AS target_tables
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="ruoyi_base" # 修改为需要更改的数据库名称
AND TABLE_TYPE="BASE TABLE"
;

  

  

posted @ 2022-11-22 22:17  洺剑残虹  阅读(1995)  评论(0编辑  收藏  举报