下载mysql8,当然你可以下载mysql8最新版
下载地址:https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.15-winx64.zip
已精简mysql-8.0.15-winx64 版本
下载地址:https://download.csdn.net/download/deeplyloving/11141721
解压到某目录:比如 d:/mysql-8.0.15-winx64
精简步骤
1. bin 目录下保留 mysqld.exe ssleay32.dll mysql.exe(非必须)
2. share 目录下保留 english\errmsg.sys
目录结构为
d:/mysql-8.0.15-winx64
bin
mysqld.exe
ssleay32.dll
mysql.exe
share
english
errmsg.sys
这样精简下来 已经很小了。如用zip压缩一下 在 13-14MB左右
初始化mysql
d:/mysql-8.0.15-winx64 下新建 data目录
进入命令行,切换到mysql-8.0.15/bin目录 执行
mysqld --initialize --console
返回:
2019-04-24T05:19:41.781428Z 0 [System] [MY-013169] [Server] D:\dev\dbs\mysql-8.0.15-winx64\bin\mysqld.exe (mysqld 8.0.15) initializing of server in progress as process 7772
2019-04-24T05:19:45.452130Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: g->E.DXWa6oI
2019-04-24T05:19:46.555585Z 0 [System] [MY-013170] [Server] D:\dev\dbs\mysql-8.0.15-winx64\bin\mysqld.exe (mysqld 8.0.15) initializing of server has completed
红色处代表 root@localhost的初始密码 授权时会用到
授权:
mysql -uroot -p
登陆mysql
修改默认密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '111111';
创建 root@% 可远程访问用户
CREATE USER 'root'@'%' IDENTIFIED BY '111111'
将加密方式由caching_sha2_password改为mysql_native_password(如不改某些客户端加密默认为mysql_native_password 将无法登陆)
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '111111';
授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
刷新权限
FLUSH PRIVILEGES;