Windows下永久解决数据库乱码 utf8 转 gbk
产生乱码原因

因为windows终端的默认字符集是gbk编码,而mysql数据库是utf8的编码,所以会产生乱码问题
解决乱码问题(临时修改)
询当前数据库默认编码:
mysql> show variables like 'character%';

修改为gbk编码:
mysql> set names gbk;

但是这只是临时修改,对新开启的终端无效。
解决乱码问题(永久)
修改MySQL的配置文件:my-default.ini
配置文件位于MySQL的安装目录
例如我的:C:\Program Files\MySQL\MySQL Server 5.7
[mysqld]character-set-server=gbk
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/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. [mysqld]character-set-server=gbk # 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 = .....
# datadir = .....
# 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
Windows下永久解决数据库乱码 utf8 转 gbk的更多相关文章
- [转]Git for windows 下vim解决中文乱码的有关问题
Git for windows 下vim解决中文乱码的问题 原文链接:Git for windows 下vim解决中文乱码的有关问题 1.右键打开Git bash: 2.cd ~ 3.vim .vim ...
- windows下git bash中文乱码解决办法
一.解决办法1:(直接上图) 1.在git bash下,右键 出现下图,选择options: 2.选择“Text” 3.将“Character set”设置为 UTF-8 转:windows下git ...
- Windows下更改MySQL数据库的存储位置
在MySQL安装完成后,要修改数据库存储的位置,比如从安装目录下的C:\Program Files\MySQL\MySQL Server 5.0\Data文件夹转移到D:\mySQLData文件夹. ...
- windows下cmd命令行显示UTF8字符设置(CHCP命令)
本文由 www.169it.com 收集整理 在中文Windows系统中,如果一个文本文件是UTF-8编码的,那么在CMD.exe命令行窗口(所谓的DOS窗口)中不能正确显示文件中的内容.在默认情况下 ...
- Windows下如何解决git bash的默认home目录路径问题
转自:http://blog.csdn.net/lucien_zhou/article/details/62069246 为了解决这个问题,我在网上找了好久,尝试过按网上其他人所述,修改 git 安装 ...
- 基于Windows下永久破解jetbrains公司的系列产品(Idea, pycharm,clion,phpstorm)
基于Windows下永久破解jetbrains公司的系列产品(Idea, pycharm,clion,phpstorm): PS : 有能力的建议购买正版,好吧. PS:均针对其对应的2018.3.1 ...
- 解决windows下nginx中文文件名乱码
我的根目录文件夹放在d盘work文件夹下,一般这样配置 nginx\conf\nginx.conf location / { root D:/work; index index_bak.html; a ...
- 记一次windows下物理迁移数据库的过程
背景: 最近因为一次设备故障,导致一台运行windows环境下的机器无法启动,里面有一个正在使用的财务数据库,该数据库也只是每月使用一次,需要把物理数据迁移出来,于是拔出了故障机器的硬盘,通 ...
- windows下安装 sphinx 数据库全文搜索引擎
此次演示的环境是:win7系统,64位,php5.4.x,apache sphinx,斯芬克斯(英语不好的同学可以直接读这个音),意狮身人面像 特点:创建索引速度快,3分钟左右能创建100万条记录的索 ...
随机推荐
- 参数 out
function outtest(out jo: ISuperObject; out s: string):Boolean; begin //进入函数时 jo =nil ErrStr = '' Res ...
- 使用 ADOX 将 Table 添加到 Catalog 时报“类型无效”的原因和解决方法
http://blog.csdn.net/kfhzy/article/details/6020283 http://blog.csdn.net/kfhzy/article/details/602054 ...
- Swift网络封装库Moya中文手册之Authentication
Authentication 安全验证可能有点复杂,一些网络请求需要认证,这里我们讨论两种常见的. Basic HTTP Auth HTTP auth是HTTP协议自带的用户名/密码验证.如果你使用的 ...
- spring的orm模块
spring整合hibernate 1.hibernate使用注解. daoImpl需要继承HibernateDaoSupport对象,针对给对象的getHibernateTemplate()进行hi ...
- 201621123010《Java程序设计》第13周学习总结
1. 本周学习总结 以你喜欢的方式(思维导图.OneNote或其他)归纳总结多网络相关内容. 2. 为你的系统增加网络功能(购物车.图书馆管理.斗地主等)-分组完成 为了让你的系统可以被多个用户通过网 ...
- 相同类型的对象不能互相转换:java.lang.ClassCastException: com.anhoo.po.UserPo cannot be cast to com.anhoo.po.UserPo
@PostMapping("/findone") public String getone(UserVo userVo) throws IllegalAccessException ...
- jquery ajax 语法
$("select[name=type_id]").change(function(e) { var val=$(this).val(); $.ajax({ ...
- 多重条件判断SQL:用于用户名称,密码,权限的检测和判断
string sqlstr = "select count(*) from tb_admin where 用户名='"+UserName+"'and 密码='" ...
- Uboot中start.S源码的指令级的详尽解析
Uboot中start.S源码的指令级的详尽解析 https://www.crifan.com/files/doc/docbook/uboot_starts_analysis/release/html ...
- Ubuntu下安装、卸载notepad++
Ubuntu下的安装方法: sudo add-apt-repository ppa:notepadqq-team/notepadqq sudo apt-get update sudo apt-get ...