FreeBSD mysql password forgot to find the way

Source: Internet
Author: User
Tags flush

Remember, the original and Linux under the solution is not the same.

The code is as follows Copy Code

# Killall-term MYSQLD//Kill all MySQL processes first
#/usr/local/bin/mysqld_safe--skip-grant-tables &


will return

The code is as follows Copy Code

100723 22:19:53 mysqld_safe Logging to '/var/db/mysql/freebsd.err '.
100723 22:19:53 Mysqld_safe starting mysqld daemon with databases From/var/db/mysql
100723 22:19:53 mysqld_safe mysqld from PID File/var/db/mysql/freebsd.pid ended

[1] Done Mysqld_safe-skip-grant-tables


If this information appears, it will be half done.

The code is as follows Copy Code


# Mysql-uroot
mysql> use MySQL;
Database changed
mysql> Update user set Password=password (' Password ') where user= ' root '
Query OK, 0 rows Affected (0.00 sec) rows Matched:4 changed:0 warnings:0
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

Another way to retrieve the root password scheme

Use the username and password provided directly in the [client] section of the/etc/mysql/debian.cnf file:

  code is as follows copy code

# mysql- Udebian-sys-maint-p

Enter Password: < Enter the [client] section's password

mysql> update user set Password=password (' NewPassword ') where user= ' root ';

Mysql> flush privileges;

Mysql> quit

# mysql-uroot-p

Enter Password: < Enter the new password newpassword>

Related Article

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.