Here are commands you need to type for each step (login as the root user):
Step 1. Stop MariaDB service.
# systemctl stop mariadb
Step 2. Start MariaDB server w/o password.
# mariadb_safe --skip-grant-tables &[1] 5988Starting mariadb daemon with databases from /var/lib/mysqlmariadb_safe[6025]: started
Step 3. Connect to mariadb server using mysql client:
# mysql -u rootWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 2Server version: 5.5.44-MariaDB MariaDB ServerType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>
Step 4. Setup new MariaDB root user password.
mysql> use mysql;mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';mysql> flush privileges;mysql> quit
Step 5. Stop MariaDB server.
# systemctl stop mariadbStopping MariaDB database server: mariadbSTOPPING server from pid file /var/run/mysqld/mysqld.pidmysqld_safe[6186]: ended[1]+ Done mysqld_safe --skip-grant-tables
Step 6. Start MariaDB server and test it.
# systemctl start mariadb# mysql -u root -p