You can reset the root password by running the server with
It is also possible to find the query that reset the password in
Note: prior to MySQL 5.7 the column was called
--skip-grant-tables
and logging in without a password by running the following as root (or with sudo):# service mysql stop
# mysqld_safe --skip-grant-tables &
$ mysql -u root
mysql> use mysql;
mysql> update user set authentication_string=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
# service mysql stop
# service mysql start
$ mysql -u root -p
Now you should be able to login as root with your new password.It is also possible to find the query that reset the password in
/home/$USER/.mysql_history
or /root/.mysql_history
of the user who reset the password, but the above will always work.Note: prior to MySQL 5.7 the column was called
password
instead of authentication_string
. Replace the line above withmysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
--
Chus ys
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
No comments:
Post a Comment