My Youtube Channel

Please Subscribe

Flag of Nepal

Built in OpenGL

Word Cloud in Python

With masked image

Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Saturday, February 3, 2024

Solved: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


Follow the given steps to solve the issue. The commands here are for CentOS 8. The solution is same for other OS as well so modify the commands accordingly.

Step 1: After the installation of MYSQL is finished, enable and start mysqld as given below:

sudo systemctl start mysqld

sudo systemctl enable mysqld

Once, done also check the status of the mysqld to verify whether it is running or not:

sudo systemctl status mysqld

Step 2: Find the temporary password and copy it using the following command:

sudo grep 'temporary password' /var/log/mysqld.log

You will see something like this:

 A temporary password is generated for root@localhost: ;ND0#VvB0*Mt

Copy the temporary password.

Step 3: Type the following command:

mysql -u root -p

Step 4: When prompted to enter password, just paste the copied temporary password and yes you are done with your task. 

Step 5: Then you can change the password for root using the command:

sudo mysql_secure_installation