How to reset MariaDB's root user password

Posted on: Sunday, Dec 17, 2017

It's really annoying to forget what your MariaDB's root account password is. However, with just a little commandline effort, it's an easy challenge to resolve. I learned most of these instructions with this Digial Ocean article. It's a great article but it instructions for ending the MariaDB mysqld process didn't work for me on Ubuntu 17.04.

Stop MariaDB
$ sudo systemctl stop mariadb
Restart the database without permission checking

This command doesn't seem to finish. After about 30 seconds or press enter to get back to a command line and go to the next step.

$ sudo mysqld_safe --skip-grant-tables --skip-networking &
Connect to database with root
$ mysql -u root
Reload grant tables with FLUSH PRIVILEGES
mysql> FLUSH PRIVILEGES;    
Reset root password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

Exit MySQL with

exit;
Find and kill the mysqld process

The command below lists the mysqld processes.

ps aux | grep mysqld

On my system, the mysqld process to kill is the one associated with user mysql and /usr/sbin/mysqld as shown below.

mysql  4267  0.0  0.5 1775204 68340 pts/0   SNl  11:43   0:01 
    /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql 
    --plugin-dir=/usr/lib/mysql/plugin --user=mysql 
    --skip-grant-tables --skip-networking --skip-log-error 
    --pid-file=/var/run/mysqld/mysqld.pid 
    --socket=/var/run/mysqld/mysqld.sock --port=3306

Kill the /usr/sbin/mysqld process with

sudo kill -SIGTERM <pid-of-mysqld-process>
Restart MariaDB
sudo systemctl start mariadb

You should now be able to log back into MariaDb with:

    mysql -u root -p

You'll be prompted for the password; enter the one you just assigned to the root account.


Comments

  • online loans bad credit <a href="http://aloan.cars">loans</a> online loans for bad credit <a href=http://aloan.cars>loans</a>


    Submitted by Payday Loans
    1 month ago
  • cash loans with monthly payments <a href="http://aloan.cars">loans</a> direct lenders payday loans <a href=http://aloan.cars>online loans bad credit</a>


    Submitted by Loan Cash
    1 month ago
  • lend money <a href="http://aloan.cars">loans</a> loans bad credit <a href=http://aloan.cars>direct loan consolidation</a>


    Submitted by Getting A Loan
    1 month ago
  • online loans bad credit <a href="http://aloan.cars">loans</a> loans <a href=http://aloan.cars>loans</a>


    Submitted by Online Payday Loan
    1 month ago
  • loans <a href="http://aloan.cars">loan for bad credit</a> loan for bad credit <a href=http://aloan.cars>loans</a>


    Submitted by Cash Loan
    1 month ago
  • online loans bad credit <a href="http://aloan.cars">loans</a> loans for bad credit <a href=http://aloan.cars>loans</a>


    Submitted by Get A Loan
    1 month ago
  • loans <a href="http://aloan.cars">online loans for bad credit</a> online loans bad credit <a href=http://aloan.cars>how does debt consolidation work</a>


    Submitted by Spotloan
    1 month ago
  • bad credit installment loan <a href="http://aloan.cars">payday loans bad credit</a> payday loans for bad credit <a href=http://aloan.cars>need a loan with bad credit</a>


    Submitted by Pay Day Loan
    1 month ago
  • loans <a href="http://aloan.cars">best loans for bad credit</a> loan with bad credit [url=http://aloan.cars]loans[/url]


    Submitted by Loans
    1 month ago
  • payday loan near me <a href="http://aloan.cars">a loan with bad credit</a> apply online <a href=http://aloan.cars>need a loan with bad credit</a>


    Submitted by Getting A Loan
    1 month ago
  • legit payday loans <a href="http://aloan.cars">loans</a> payday loans for bad credit <a href=http://aloan.cars>a loan with bad credit</a>


    Submitted by Loans
    1 month ago
  • stafford loans <a href="http://aloan.cars">bad credit loan</a> payday loans in nc <a href=http://aloan.cars>best cash advance loans online</a>


    Submitted by A Payday Loan
    1 month ago
  • loan bad credit <a href="http://aloan.cars">speedy</a> loans <a href=http://aloan.cars>a loan with bad credit</a>


    Submitted by Payday Express
    4 weeks ago
  • payday loan near me <a href="http://aloan.cars">direct lender installment loans</a> loan with bad credit <a href=http://aloan.cars>no credit check payday</a>


    Submitted by Cash Advance
    4 weeks ago



Add your comment
You email is never shared with anyone else.

© Copyright 2017 by Roger Pence. All rights reserved.