Forgot your MySQL password problem
With MySQL, we may often forget the MySQL password, this time, you can think of, what does? Reluctantly reload?Unwise, we can use the following methods to solve the problem of your MySQL password.
(1) Open / etc / mysql directory under the debian.cnf file, find the [client] user name and password used to log in MySQL
root @ ubuntu: ~ # vi / etc / mysql / debian.cnf
Debian-sys-maint user login, password is the password image above:
And then restart the mysql server can log in with the new password set.
(2) We also can not password to access MySQL, then change the password on it, as follows.
First off mysqld process in two ways.
can directly stop directly Close mysqld: root @ ubuntu: ~ # / etc / init.d / mysql stop
first use ps-aux Find the mysqld process corresponds to the pid number, and then use the kill command to kill the pid number:
Then start mysqld with the – skip-Grant-tables parameter:
root @ ubuntu: ~ # / usr / bin / mysqld_safe – skip-grant-tables &
Input mysql shell command line, then the user’s password changes.