The first step:
Modify the My.ini file to replace it with the following (skip_grant_tables*** focus )
# for advice The Change settings see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# Do not EDIT the this FILE. It's a template which 'll be copied to the# ***defaultLocation during install, and would be replacedifyou#***upgrade to a newer version of MySQL. [mysqld]# Remove Leading # andSetTo the amount of RAM forThe most important data# cacheinchMysql. Start at -% of Total RAM forDedicated server,Else Ten%. # 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 is commonlySet, remove the # andSet asrequired.# Basedir=.... # datadir=..... # Port=.... # server_id=... # Remove leading # toSetOptions mainly useful forreporting servers.# The server defaults is faster fortransactions and fast selects.# Adjust sizes asneeded, experiment to find the optimal values.# join_buffer_size=128m# sort_buffer_size=2m# read_rnd_buffer_size=2M ######################################################### [client] Port=3306 default-character-Set=UTF8 [mysqld] skip_grant_tables Port=3306Character_set_server=UTF8 Basedir=e:\mysql-5.7. --winx64 #解压目录 DataDir=e:\mysql-5.7. --winx64\data #解压目录下data目录 Sql_mode=no_engine_substitution,strict_trans_tables [winmysqladmin] E:\mysql-5.7. --winx64\bin\mysqld.exe########
Step Two:
Go to the MySQL installation directory, press shift+ (right mouse button) Click the Command Line window to initialize with Mysqld--initialize (will create a data folder in the installation directory)
Step Three:
Enter command line mode under the installation directory folder shift+ (right mouse button) using net start MySQL startup service
Login with mysql-uroot-p without password
After entering
mysql> use MySQL;
mysql> Update user set Authentication_string=password ("123") where user= "root"; (don't forget the last semicolon)
Mysql>flush privileges;
mysql>quit;
Fourth Step:
Entering the My.ini file will Skip_grant_tables comments
Re-entry command line
net stop MySQL
net start MySQL (restart service)
Mysql-uroot-p
(log in with the changed password)
succeed;
*************************************************************************************************************** *********
Last hint: If the net start MySQL prompt cannot start the service, and no prompt error can be removed from the Data folder reinitialization start
MySQL configuration installation and root password changes