• 【手游项目4】数据库navicat.exe -自动编码打开乱码问题


    问题描述

    前后端用的UTF8,前后端正常,navicat.exe编辑链接->高级->选择UTF8也不乱码,但是选择自动就乱码。

    现在我们后台那边也乱码,所以我怀疑自动编码就是mysql默认编码。

    我 vi /etc/my.cnf  设置了编码也没用。最后试着修改了数据库的编码,搞好了

    最终解决:右键数据库->编辑数据库->字符集(latin1) && 排序规则(latin1_swedish_ci)

    解决过程如下

    vi /etc/my.cnf
    指定配置路径启动
    mysqld --defaults-file=/etc/my.cnf --user=root
    service mysql restart
    service mysqld start
    
    mysql -u root -p
    show variables like '%char%';
    
    set global character_set_client=latin1;
    set global character_set_connection=latin1;
    set global character_set_database=latin1;
    set global character_set_results=latin1;
    set global character_set_server=latin1;
    
    
    彻底解决mysql中文乱码
    https://blog.csdn.net/u012410733/article/details/61619656
    
    
    最终解决
    linux终端
    mysql> show variables like '%char%';
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | latin1                     |
    | character_set_connection | latin1                     |
    | character_set_database   | latin1                     |
    | character_set_filesystem | binary                     |
    | character_set_results    | latin1                     |
    | character_set_server     | latin1                     |
    | character_set_system     | utf8                       |
    | character_sets_dir       | /usr/share/mysql/charsets/ |
    +--------------------------+----------------------------+
    
    navicat.exe - 命令列界面
    mysql> show variables like '%char%';
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | utf8mb4                    |
    | character_set_connection | utf8mb4                    |
    | character_set_database   | latin1                     |
    | character_set_filesystem | binary                     |
    | character_set_results    | utf8mb4                    |
    | character_set_server     | latin1                     |
    | character_set_system     | utf8                       |
    | character_sets_dir       | /usr/share/mysql/charsets/ |
    +--------------------------+----------------------------+
    8 rows in set (0.01 sec)
    
    右键数据库->编辑数据库->字符集(latin1) && 排序规则(latin1_swedish_ci)
    
    
    
    
    
    
  • 相关阅读:
    从docker容器拷贝文件出来
    R csv数据集资源下载
    使用docker镜像搭建Python3 jupyter notebook环境
    用Python合并多个Excel文件
    vscode保存文件时自动删除行尾空格
    js判断数组是否包含某元素
    数据库锁问题
    协程
    进程间的八种通信方式
    进程与线程的区别
  • 原文地址:https://www.cnblogs.com/byfei/p/14104102.html
Copyright © 2020-2023  润新知