Home > AI > Uncategorized

How to change MySQL root password

Step 1: stop the MySQL server

Step 2: on one terminal try sudo mysqld_safe --skip-grant-tables to start the MySQL server without requiring password

Step 3: on another terminal

mysql -u root

mysql> use mysql
Database changed

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Query OK, 0 rows affected (0.01 sec)
Related posts:

Leave a Reply