lxq.link
postscategoriestoolsabout

Setting the MySQL root user password

If you don't remember the password you set for root and need to reset it, follow these steps:

Stop the mysqld server, this varies per install

Run the server in safe mode with privilege bypass

sudo mysqld_safe --skip-grant-tables

In a new window connect to the database, set a new password and flush the permissions & quit:

mysql -u root
#For MySQL older than MySQL 5.7 use:

UPDATE mysql.user SET Password=PASSWORD('your-password') WHERE User='root';

#For MySQL 5.7+ use:

UPDATE mysql.user SET authentication_string=PASSWORD("your-password") WHERE User='root';

#Refresh and quit:

FLUSH PRIVILEGES;

\q
2020-05-21