Error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: no)

Error 1045 (28000): access denied for user ‘root’ @’localhost ‘(using password: no)

The solution steps are as follows:

1. First stop the database service: systemctl stop mariadb.service

2. Use mysqld_ Safe to start mysqld server: mysqld_ safe –user=mysql –skip-grant-tables –skip-networking &

Display: exit Ctrl + C

3. Login: MySQL – U root mysql

4. Modify the password of the root user: update user set password = password (‘newpassword ‘) where user’s root’;

5. Use the modified root user and new password to log in to the database: MySQL – uroot – P

 

The MariaDB server is running with the –skip-grant-tables option so it cannot execute this statement

An error occurred when creating a user. The execution statement is:

GRANT ALL PRIVILEGES ON *.* TO helei IDENTIFIED BY ‘MANAGER’ WITH GRANT OPTION;

Solution: MySQL & gt; flush privileges;

Reference: MariaDB initial login error 1045 (28000) solution

https://blog.csdn.net/carry9148/article/details/52252780

Read More: