Change MySQL root password in Windows
suggest changeTo change the root password on Windows:
Step 1: Open a command prompt. Press Ctrl+R, or open Start Menu > Run, type cmd, and press Enter.
Step 2: Change to the directory where MySQL is installed. For example:
C:\> cd C:\mysql\bin
Step 3: Start the mysql client. This connects as root with no password, which works only when root has none:
C:\mysql\bin> mysql -u root mysql
Step 4: Set the root password. PASSWORD() was removed in MySQL 8.0, so prefer ALTER USER (available since 5.7.6):
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'my_new_password';
On MySQL 5.6 and earlier:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('my_new_password');
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents