Windows 安装Mysql7
解压mysql到指定目录:E:\Development\mysql-5.7.23-winx64
配置系统环境变量:
MYSQL_HOME = E:\Development\mysql-5.7.23-winx64
在系统环境变量path中最后添加:
%MYSQL_HOME%\bin;
在 mysql-5.7.23-winx64 目录下创建my.ini文件,编写mysql的配置:
[mysqld]
max_connections=100
character_set_server=utf8
basedir="E:/Development/mysql-5.7.23-winx64"
datadir="E:/Development/mysql-5.7.23-winx64/data"
到mysql-5.7.23-winx64\bin目录下执行初始化命令:
mysqld --initialize(初始化数据库)
mysqld -install(注册windows服务默认名为MySQL)
到mysql-5.7.23-winx64\data目录下的DESKTOP-FFH2BPI.err, 后缀是err的文件找初始root密码:
2019-07-06T01:01:40.392251Z 1 [Note] A temporary password is generated for root@localhost: iJ2o3HrVol;1 <-(这就是密码)
接下来到服务里边启动mysql或者命令行(net start mysql),root登录:
mysql -u root -p
然后修改初始密码:
alter user user() identified by "root";
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;
exit;