CENTOS7 mariadb First change password and forgot password processing method

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.