First Change Password
First Kind
>mysqladmin-u Root-p[oldpass] Password newpass
Note Oldpass (old password) optional, if the root default password is empty, you do not need to enter
If you need to change the old password, please note that there is no space between the old password and-p, otherwise it will be error, in addition Password and newpass (new password) are separated by a space.
The second Kind
Initializing the database
/usr/local/mysql/bin/mysql_secure_installation Yum installation is in/usr/bin/mysql_secure_installation
Start initialization after
See Hints
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "alt=" Wkiol1aty_ab5hhaaaafscaaxxm571.png " Style= "Background:url ("/e/u261/lang/zh-cn/images/localimage.png ") no-repeat center;border:1px solid #ddd;" Title= " 4.png "/>
Forget the password
Systemctl Stop mariadb ==> stopping the MARIADB database
Mysqld_safe --skip-grant-table & ==> into stand-alone mode
Mysql
Use mysql;==> into MySQL library
Update user set Password=password (new password) where user= ' root ' and host= ' localhost ';==> set a new password
Flush Privileges;==> Refresh
New open Window mysqladmin-uroot-p shutdown ==> new password test shut down the database, successfully closed to prove the success of the modification
Systemctl Restart MARIADB ==> Restart Service
Skip_name_resolve = On
The second method of
Vim/etc/my.cnf
[Mysqld]
Skip-grant-tables Add this line, then save, restart the service, MySQL can go directly into the changes. Ditto.
This article is from the "what-all" blog, please be sure to keep this source http://hequan.blog.51cto.com/5701886/1768386
CENTOS7 mariadb First change password and forgot password processing method