dkoug Blog

Reset mysql root password

MySQL Server -- Posted on Oct. 18, 2018

Reset mysql root password

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
MySQL 5.7 and up don't support connecting as "root" in mysql-workbench so you must create a normal user and connect via that.

sudo mysql -u root -p

Create a user named "admin" and use that to connect in mysql-workbench.

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;



service mysql stop
service mysql start --skip-grant-tables
mysql

use mysql;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD("pass");
flush privileges;
quit;