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> |