How To Reset MySQL Or MariaDB Root Password

Reset MySQL Or MariaDB Root Password

3 Responses

  1. matthew says:

    By mariadb 10 (10.0.38-0ubuntu0.16.04.1) this no longer works as expected. Password is set in the mysql.user database but (1) as root it pays no attention to the password, you can type anything or nothing at the password prompt and you can log in and (2) as any other user ‘mysql -u root -p’ rejects the password.

  2. Nissaar says:

    Run ‘ sudo mysql -u root -p ‘ instead of ‘ mysql -u root -p ‘
    It should work

  3. Jim says:

    The changes about the root user authentication are explained at:
    https://mariadb.com/kb/en/authentication-from-mariadb-104/

    in particular: “Using unix_socket means that if you are the system root user, you can login as [email protected] without a password. ”

    — that is, if you run the login as the root user, which is why “sudo mysql -u root ” is necessary on Ubuntu/Debian style systems, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.