Maria forgot password

Source: Internet
Author: User

 

1. Find the mariadb configuration file.
Command: Find/-name my. CNF

Note: generally in/etc/My. CNF

2. modify the configuration file
Add one line in the [mysqld] configuration of the mariadb configuration file/etc/My. CNF: Skip-grant-tables

#===================================================== ======================
[Mysqld]
Datadir =/var/lib/MySQL
Socket =/var/lib/MySQL. Sock
Skip-grant-tables # Note: This line is inserted.


# Disabling symbolic-links is recommended to prevent assorted Security Risks
Symbolic-links = 0
# Settings user and group are ignored when then EMD is used.
# If you need to run mysqld under a different user or group,
# Customize your every EMD unit file for mariadb according to
# Instructions in http://fedoraproject.org/wiki/Systemd

[Mysqld_safe]
Log-error =/var/log/mariadb. Log
PID-file =/var/run/mariadb. PID
Skip-grant-tables

#
# Include all files from the config directory
#
! Includedir/etc/My. CNF. d

#===================================================== ======================

3. Use SQL to change the root password
[[Email protected] ~] $ Mysql


Mariadb [MySQL]> Update user SET Password = PASSWORD ('100) where user = 'root ';
Query OK, 4 rows affected (0.03 Sec)
Rows matched: 4 changed: 4 Warnings: 0

Mariadb [MySQL]> flush privileges;
Query OK, 0 rows affected (0.01 Sec)

Mariadb [MySQL]> exit

4. Complete. Cancel password-free logon and restart mariadb.

5. Attach commands related to mariadb.

Query status: systemctl status mariadb
Disable: systemctl status mariadb
Enable: systemctl stop mariadb
Restart: systemctl restart mariadb

Maria forgot password

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.