下載
https://downloads.mysql.com/archives/community/
解壓,創(chuàng)建配置文件
image-20211123094405539.png
初始化
在安裝目錄的bin目錄下它呀,以管理員身份打開powershell狱掂,用以下命令初始化
./mysqld.exe --initialize-insecure
至此懦尝,MySQL的安裝已完成忆绰。
啟動(dòng)MySQL
1.臨時(shí)啟動(dòng)(不建議)
./mysqld.exe
2.制作成Windows服務(wù)凿蒜,用服務(wù)來(lái)進(jìn)行關(guān)閉和開啟速侈。
mysqld.exe --install mysql8
net start mysql8 # 啟動(dòng)服務(wù)
net stop mysql8 # 關(guān)閉服務(wù)
連接
./mysql.exe -h 127.0.0.1 -P 3306 -u root -p
密碼默認(rèn)為空抱既,直接回車
這時(shí)應(yīng)該登陸成功了
修改密碼(版本8.0以上)
alter user 'root'@'localhost' identified by 'root';
或
set password for root@localhost = '123456';
退出(關(guān)閉連接)
exit;