Reset mysql password

Reset mysql password

First try to see if you can login to mysql as root.
ssh to root user, or su root from AD login.

      mysql

If you get an error similar to:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Then the password is likely incorrect. You can sometimes check and see what the password is in /root/.mysql
but almost always (It should be always) It's encrypted.

Now stop the mysql process this can be one of a few slightly different commands:

      systemctl stop mysql
      systemctl stop mysqld
      service mysql stop
      service mysqld stop

Once you get a confirmation the service is stopped, run

      mysqld_safe --skip-grant-tables &

This will put a mysql process without needing a password in the background. Then

      mysql

You should now be logged in as root.
Now run the commands to change the password, ensure you change "mynewpassword" with your password.
You can run one command at a time

      use mysql;
      update user set authentication_string=PASSWORD("mynewpassword") where User='root';
      flush privileges;
      quit

Then restart the mysql process again (Remember the differences in the commands from before)

      service mysql stop && service mysql start

The password should now be changed!
Test it with:

mysql -u root -p "mynewpassword"
    • Related Articles

    • Reset password manually in OnApp

      When password reset in onApp fails or does not work you can manually reset the password with the following process   Reboot in recovery. Login via recovery with user/password being root/recovery or root/defaultrootpassword <-- could be either one, ...
    • MySQL

      MySQL     Log into MySQL: mysql -uUSERNAME -p'PASSWORD' List Users: SELECT User FROM mysql.user; Create & Modify Users: CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; Once you have ...
    • New Access Management User setup on Linux

      1) Login to your accounts.cartika.com account 2) Select your access management service (customers with managed infrastructure in both the US and CAD will have two) 3) Navigate to Login to SolidCP -> Click Login 4) Click on Users under your Hosted ...
    • Manually Resetting Wordpress Password

      In WordPress, there is more than one way to set your password. In normal circumstances, you can do it through the WordPress interface. If you forget your password, WordPress has a built in recovery mechanism that uses email. But on some hosts, ...
    • New Access Management User setup on Windows 2008 / 2008r2

      In order to manage your GDPR compliant access to Windows 2008 You will need to create  1) Login to your accounts.cartika.com account 2) Select your access management service (customers with managed infrastructure in both the US and CAD will have two) ...