mysql 启动1067错误及修改字符集重启之后复原无效问题

下载了官网的解压版mysql-5.6.37-winx64.zip,修改了配置文件,安装服务,直接使用;

出现了中文乱码, 解决办法:

在mysql-5.6.37-winx64目录下,新创建并配置一个my.ini文件(内容可以从网上找,也可以参考my-default.ini手动配置)

注意:

[client] 节点位置千万别放错,比如:

错误方式:

[mysqld]
character-set-server=utf8
# 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
[client]
default-character-set=utf8
# Remove leading # to turn on a very important data integrity option: logging

ps:下面这些属性,是[mysqld]节点下的,    这样放置[client]节点的话,就变成[client]的属性了 

导致后面报错:mysql: unknown variable 'basedir=D:\mysql-5.6.37-winx64'

basedir = D:\\mysql-5.6.37-winx64
 datadir = D:\\mysql_data

正确方式 应该是吧[client]节点放到最后面或者最前面 ,别放在[mysqld]节点里面,至于 net start mysql 启动mysql服务 出现 1067错误,查看日志发现

MySQL: Table 'mysql.plugin' doesn't exist
2017-10-17 11:40:50 2928 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-10-17 11:40:50 2928 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist,
最后将datadir = D:\\mysql_data 改为 datadir = D:\\mysql-5.6.37-winx64\\data

服务启动完成(因为之前没有创建my.ini,一直用的是默认配置,所以数据位置路径对应不上,改过来就好了)

总结

相关推荐