Resetting ROOT password in MySQL 5.6

2019-01-08 20:39发布

I have been following these instructions for resetting root password for local installation of MySQL 5.6 on Windows 7 laptop.

I stopped the service, created init-file, and ran the following command (as Administrator):

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" --init-file=C:\\MySQL-misc\\mysql-init.txt

I got the following warning:

2014-02-08 15:44:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

Since it's a warning I'm not sure whether I need to fix anything and then redo the process again.

Currently the command window is still on and does not accept any input. Should I force-close it or is there anything I can do to complete the process gracefully?

UPDATE

I killed the Command window and tried to restart the service. Got an error.

Restarted Windows and the service automatically started. The new root password seems to work. I was successfully able to use various functions of Workbench that require the password.

So, the warning was indeed just a warning.

7条回答
时光不老,我们不散
2楼-- · 2019-01-08 21:45

For MySQL 5.6 on Windows I had to run this statement to make it work.

UPDATE mysql.user
SET Password=PASSWORD('NEW PASSWORD'), 
authentication_String=PASSWORD('NEW PASSWORD')
WHERE User='root';
查看更多
登录 后发表回答