Skip to content

Instantly share code, notes, and snippets.

@murarisumit
Last active August 29, 2015 14:21
Show Gist options
  • Save murarisumit/c9dc8ea8f330dd70f578 to your computer and use it in GitHub Desktop.
Save murarisumit/c9dc8ea8f330dd70f578 to your computer and use it in GitHub Desktop.
Change root password for MySQL/MariaDB debian/ubuntu

Set / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal.

  1. Stop the MySQL Server.

    sudo /etc/init.d/mysql stop

  2. Start the mysqld configuration.

    sudo mysqld --skip-grant-tables &

  3. Login to MySQL as root.

    mysql -u root mysql

  4. Replace YOURNEWPASSWORD with your new password!

    UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment