win10安装MySql 5.7.23
下载安装
因为Django2.1不再支持MySQL5.5,这里需要重新安装一下MySQL
首先去官网下载
这里使用的是msi版本
https://dev.mysql.com/downloads/windows/installer/5.7.html
下载后双击进行安装
这里选择服务器或者最后一个自定义都可以
自定义可以自己选择安装的部分和MySQL的安装位置
一路next,输入密码,安装结束
配置环境变量
找到MySQL的安装目录,默认C:\Program Files\MySQL\MySQL Server 5.7
,
打开后里面有个bin
目录,拷贝路径C:\Program Files\MySQL\MySQL Server 5.7\bin
,
将其添加到Path中,注意后面有个bin
修改字符集
个人版本MySQL5.7.23,默认安装
通过SHOW VARIABLES LIKE "character_set%";
查看字符集
这是修改过的
mysql> SHOW VARIABLES LIKE "character_set%";
+--------------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.7\share\charsets\ |
+--------------------------+---------------------------------------------------------+
8 rows in set, 1 warning (0.00 sec)
C:\ProgramData\MySQL\MySQL Server 5.7
下面有一个my.ini
文件
将这个文件拷贝到MySQL的安装目录,默认目录C:\Program Files\MySQL\MySQL Server 5.7
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
修改内容
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
重启服务就行了