Home >Database >Mysql Tutorial >Detailed graphic and text explanation of the solution to the Mysql ERROR 1045 (28000) error problem in the ubuntu system

Detailed graphic and text explanation of the solution to the Mysql ERROR 1045 (28000) error problem in the ubuntu system

黄舟
黄舟Original
2017-05-21 09:22:422554browse

This article mainly introduces the ubuntu systemInstallationmysqlLogin prompt to solve Mysql ERROR 1045 (28000): Access denied for user root@ localhost problem, Friends in need can refer to the

first method:

skip-grant-tables: very useful mysql startup parameters

Introducing a very useful mysql startup parameter— — --skip-grant-tables. As the name suggests, grant-tables, the authorization table, is not started when starting
mysql. what's the function? Of course it is useful after forgetting the administrator password.

Start mysql with command line parameters: # /usr/bin/mysqld_safe --skip-grant-tables &

3. Change the administrator password:

use mysql;
update user set password=password('yournewpasswordhere') where user='root'; flush privileges; exit;

4. Kill mysql and restart mysql.

Then you can log in directly

Method 2:

Check the path of mysql installation

Then we change the root user's Password,

Check the default password first

Then log in directly

Then change the root default user name and password

GRANT ALL PRIVILEGES on *.* to 'root'@'localhost' identified by '密码';
flush privileges;
 mysql>update mysql.user set password=password('新密码') where User="test" and Host="localhost";
  mysql>flush privileges;
  mysql>delete from user where User='root' and Host='localhost';
  mysql>flush privileges;
mysql>grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";
mysql> UPDATE user SET Host='127.0.0.1' WHERE User='root' AND Host='localhost';mysql> flush privileges;

Change Grant_priv to 'Y' Yes (flush privileges; (effective after executing this statement or restarting MySQL)), update mysql.user set Grant_priv='Y' where user='ptmind';

The above is the detailed content of Detailed graphic and text explanation of the solution to the Mysql ERROR 1045 (28000) error problem in the ubuntu system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn