1、解壓到目標文件夾,添加環境變量
在系統變量的path目錄中,添加Mysql的bin目錄進去
如:D:\MySQL\mysql-8.0.23\bin
2、配置my.ini文件
[mysqld]
basedir=D:\mysql-8.0.0\
datadir=D:\mysql-8.0.0\data\
port=3306
3、啟動管理員模式的cmd
4、進入mysql下的bin目錄
1、執行mysqld -install,進行mysql安裝
2、執行mysqld --initialize-insecure --user=mysql進行初始化
3、使用net start mysql啟動mysql,使用mysql -u root -p進入mysql管理界面(密碼可為空)
4、進入界面后更改mysql密碼
執行alter user 'root'@'localhost' identified by '設置的新密碼';
5、輸入flush privileges;刷新權限
6、net stop mysql可以停止mysql
5、忘記密碼
在管理員命令行執行mysqld --console --skip-grant-tables --shared-memory
另開一個管理員命令行執行mysql -u root -p登錄進去
輸入use mysql;
執行update user set authentication_string='' where user='root';將密碼置為空
設置新密碼alter user 'root'@'localhost' identified by '設置的新密碼';
6、清空服務
sc delete mysql