Monday, 9 January 2023

Reset Password for mariadb 10.4 or Later

 

 Check mysql --version 

MariaDB output mysql Ver 15.1 Distrib 10.4-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 

Stop MariaDB

sudo systemctl stop mariadb  

Configuring MariaDB to Start Without Grant Tables 

sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking" 

sudo systemctl start mariadb (ensure it started with "sudo systemctl status mariadb") 

sudo mysql -u root -p 

MariaDB prompt Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

MariaDB [(none)]> (reload the grant tables by issuing the FLUSH PRIVILEGES command) 

MariaDB [(none)]>FLUSH PRIVILEGES; 

MariaDB [(none)]>SET PASSWORD FOR root@localhost = PASSWORD ('NEWPASSWORD'); 

Output Query OK, 1 row affected (0.00 sec)

No comments:

Post a Comment