如今mysql壓縮包:https://downloads.mysql.com/archives/community/mysql
在目錄下新建my.ini文件,data文件夾,內容以下:sql
[mysqld] basedir = F:\mysql-8.0.13-winx64 datadir =F:\mysql-8.0.13-winx64\data port = 3306 lower_case_table_names = 2 default_authentication_plugin=mysql_native_password
使用管理員身份打開dos窗口(powershell),執行命令:shell
mysqld.exe --initialize --console
複製結果中的密碼:ide
2019-04-01T06:04:04.796850Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.14-winx64\bin\mysqld.exe (mysqld 8.0.14) initializing of server in progress as process 12764
2019-04-01T06:04:10.085559Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 3/3FEF)xPFaZ
2019-04-01T06:04:11.442346Z 0 [System] [MY-013170] [Server] D:\mysql-8.0.14-winx64\bin\mysqld.exe (mysqld 8.0.14) initializing of server has completedspa
而後執行安裝命令:code
mysqld.exe --install
提示安裝成功:server
Service successfully installed.
接着啓動mysqlblog
net start mysql
mysql啓動成功:it
MySQL 服務正在啓動 .. MySQL 服務已經啓動成功。
最後要修改mysql的密碼:io
mysql.exe -uroot -p
輸入剛纔複製的密碼,而後修改密碼:
alter user 'root'@'localhost' identified with mysql_native_password by 'aaa123';