一、下載
官網下載:MySQL下載
二、安裝
1.解壓到本地
2.添加系統變量
3.生成Data文件
- mysql安裝目錄下打開cmd窗口
- 執行命令
mysqld --initialize-insecure --user=mysql
即可發現在根目錄下生成data目錄
4.安裝mysql
mysqld -install
5.啓動mysql服務
net start MySQL
6.登陸mysql
# 不用輸入密碼,直接回車
mysql -u root -p
7.查詢並修改用戶密碼
select host,user,authentication_string from mysql.user;
use mysql;
update mysql.user set authentication_string=("你的新密碼") where user="root";
# 若修改密碼不成功使用
# alter user 'root'@'localhost' identified with mysql_native_password by '你的新密碼';
flush privileges; # 刷新權限
quit; # 退出
8.重新登錄mysql
mysql -u root -p