a. Backup the database using tools like command-line or Navicat UI to import the DB SQL. b. Download the MySQL ver5.7 green version from the official website. c. Use admin privileges to open the command line and execute the following commands:
1 2 3 4
mysqld -install mysqld --initialize-insecure --user=mysql net start mysql // If your service name is mysql
Setting the new password for root:
1 2 3 4 5
mysqld --skip-grant-tables Jump to another new command line window, execute the `mysql` command Input the following on the `mysql>` prompt: update mysql.user set authentication_string=password("newpassword") where user="root"; flush privileges;
d. Create a new INI config file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[mysqld] port = 3306 basedir=D:\mysql-5.7.43-winx64 datadir=D:\mysql-5.7.43-winx64\data max_connections=150 character-set-server=utf8 default-storage-engine=INNODB sql_mode=NO_ENGINE_SUBSTITUTION // For previous compatibility, importantly explicit_defaults_for_timestamp=0 // For previous compatibility, importantly event_scheduler=ON max_allowed_packet=256M sort_buffer_size=3M #log_error=D:\mysql-5.7\error.log // Debug if open [mysql]
Once all the above steps are completed smoothly, you can proceed to import your database SQL and data using the backup files.