Cara reset password root di MariaDB

Oracle, which supports MySQL, said that it will support MySQL in open mode until 2015. In connection with which many began to abandon MySQL, moving to MariaDB, including CentOS. MariaDB is a MySQL developer’s product made on the basis of MySQL 5.1 sources, at the moment the project is fully open and supported by the developer. Reset the root password in MariaDB: Stop MySQL:

Reset the root password in MariaDB:

Stop MySQL:

# Service mysqld stop

Run MySQL in safe mode:

# Mysqld_safe --skip-grant-tables & [1] 20224

We see a conclusion about this:

# 140409 10:56:16 mysqld_safe Logging to '/var/lib/mysql/server.err'.
140409 10:56:16 mysqld_safe Starting mysqld daemon with databases from / var / lib / mysql
mysql -u root

Enter MariaDB without password:

# Mysql -u root 

We see about the following:

Welcome to the MariaDB monitor. Commands end with; Or \ g.
Your MariaDB connection id is 1
Server version: 5.5.36-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type 'help;' Or '\ h' for help. Type '\ c' to clear the current input statement.

MariaDB [(none)]> 

If you have everything the way I described above, enter the command:

MariaDB [(none)]> update mysql.user set password = PASSWORD ("NewPass") where User = 'root'; 

Where instead of NewPass prescribe a new password for MariaDB.

If everything is correct we get the answer:

Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0 

We do Flush privileges:

MariaDB [(none)]> flush privileges; 

We get:

Query OK, 0 rows affected (0.00 sec) 

Everything is ready, now you can go out:

MariaDB [(none)]> exit; 

We get:

Bye

It remains only to reload MySQL:

 # Service mysqld restart

Thus, we changed the root password for MariaDB.