Reset Mysql root user's password
1. Stop MySQL:
Win: Stop it in services.msc, or run ...
Win: Stop it in services.msc, or run ...
net stop mysql
2. Sometimes in Windows it is necessary to uncomment this line in /windir/system32/drivers/etc/hosts:
127.0.0.1 localhost
3. Start the MySQL server specifying your defaults-file (if you don't know that filename, see "What config file is the MySQL server using?"), and bypassing authentication ...
mysqld --defaults-file="..." --skip-grant-tables
4. In another commandline window, start the mysql client:
mysql
5. Verify that the name of the admin user is 'root'; you cannot create users when running with skip-grant-tables):
select user,host,authentication_string from mysql.user;
6. Change root user's password
Substitute the desired root password for 'new_pwd':
-- Ver 14.14 Distrib 5.7.22, for Win64 (x86_64):
flush privileges;
alter user 'root'@'localhost' identified by 'new_pwd';
flush privileges;
exit;
7. Stop mysqld in Task Manager or in another command window...
mysqladmin shutdown
8. Restart MySQL
Yorumlar