1.解壓mysql
2.新建my.inisql
[mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. basedir = "D:\mysql-5.7.26-winx64\mysql-5.7.26-winx64" datadir = "D:\mysql-5.7.26-winx64\mysql-5.7.26-winx64\data" character-set-server = utf8 port = 3306 skip-grant-tables
3.在bin目錄下執行一下命令,會自動建立data文件夾ui
mysqld --initialize
4.在bin目錄下輸入下面命令,啓動服務 code
mysqld –install
5.啓動mysql服務server
net start mysql
6.輸入命令進入mysql,更新密碼ip
update mysql.user set authentication_string=password('123456789') where user='root';
7.刷新權限rem
flush privileges
8.刪除my.ini中最後一句:skip-grant-tablesstring
9.重啓mysqlit
net stop mysql net start mysql