window安装两个版本的mysql 一个为mysql5.6 一个为mysql8.0
1.到需要配置单mysql bin目录下:cd F:\project\mysql8\bin
F:
2. 初始化:mysqld --initialize --console 初始化之后,控制台会打出临时密码:把密码保存下来,后续需要使用
3. 安装mysql服务, mysqld --install MySQL2 我配置的服务名称叫做MySQL2 这里可以修改
4.net start MySQL2 启动服务
5.mysql -uroot -p -P3307 根据配置的端口登录mysql
密码就是第二步中的临时密码。
6.登录成功后修改密码
alter user 'root'@'localhost' identified by '[email protected]';
7.添加新的管理员用户,并给新用户赋权
create user 'admin'@'localhost' identified by '[email protected]';
grant all on *.* to 'admin'@'localhost';
flush privileges;
参照一下网址:
https://blog.****.net/qq_37350706/article/details/81707862
https://blog.****.net/wudinaniya/article/details/82455431