# Stop MySQL ```bash sudo service mysql stop ``` # Make MySQL service directory. ```bash sudo mkdir /var/run/mysqld ``` # Give MySQL user permission to write to the service directory. ```bash sudo chown mysql: /var/run/mysqld ``` # Start MySQL manually, without permission checks or networking. ```bash sudo mysqld_safe --skip-grant-tables --skip-networking & ``` # Log in without a password. ```bash mysql -uroot mysql Update the password for the root user. UPDATE mysql.user SET authentication_string=PASSWORD('YOURNEWPASSWORD'), plugin='mysql_native_password' WHERE User='root' AND Host='%'; EXIT; ```