CentOS 7 reset mysql password

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

Step # 1 : Stop mysql service
systemctl stop mariadb

Step # 2: Start to MySQL server w/o password:
mysqld_safe –skip-grant-tables &

Step # 3: Connect to mysql server using mysql client:
mysql -u root

Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD(“new-password”) where User=’root’;
mysql> flush privileges;
mysql> quit

How to show database:
#################

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)

mysql> use mysql;
mysql> show tables;
mysql> select user,password,host from user;