欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mysql 5.7.22安装配置(windows环境)

程序员文章站 2022-07-05 16:36:40
...

实际安装环境是 Windows server 2012R2

1、安装步骤

选择Server Computer↓↓↓

mysql 5.7.22安装配置(windows环境)

mysql 5.7.22安装配置(windows环境)

mysql 5.7.22安装配置(windows环境)

mysql 5.7.22安装配置(windows环境)

mysql 5.7.22安装配置(windows环境)

mysql 5.7.22安装配置(windows环境)

2、配置

1)将mysql的path目录追加到系统path变量中:如;C:\Program Files\MySQL\MySQL Server 5.7\bin

2)在cmd中登录mysql,命令:mysql -u root -p,然后查看编码,命令如下:

SHOW VARIABLES LIKE 'char%';

或  SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';

3)编码修改

在mysql安装目录,如C:\Program Files\MySQL\MySQL Server 5.7\bin新建my.ini配置文件,内容如下:

[client] 
default-character-set = utf8mb4

[mysql] 
default-character-set = utf8mb4

[mysqld] 
character-set-server = utf8mb4 

[mysqld]还有其它配置项,如:

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
init_connect='SET NAMES utf8mb4'

 配置完成后,重启mysql服务,再次查看编码结果如下:

mysql 5.7.22安装配置(windows环境)

4)时区查看和设置

SHOW VARIABLES LIKE '%time_zone%'
SET GLOBAL time_zone = '+8:00';
SET time_zone = '+8:00';

5)设置IP可以访问

首先查看

use mysql;
select user,host from user;

然后将相应的用户的host改成%

update user set host='%' where user='root';