Mysql access denied for user root localhost windows

I’m trying to run WordPress in my Windows desktop and it needs MySQL.

I install everything with Web Platform Installer which is provided by Microsoft. I never set a root password for MySQL and in the final step of installing WordPress, it asks for a MySQL server password.

What is the default password for root (if there is one) and how to change it?

I tried:

mysql -u root password '123'

But it shows me:

Access denied for user 'root@localhost' (using password:NO)

After this I try:

mysql -u root -p

However, it asks for a password which I don’t have.


Update: as Bozho suggested, I did the following:

  1. I stopped the MySQL Service from Windows services

  2. Opened CMD

  3. Changed the location to c:\program files\mysql\bin

  4. Executed the command below

    mysqld --defaults-file="C:\\program files\\mysql\\mysql server 5.1\\my.ini" --init-files=C:\\root.txt

  5. The command ran with a warning about character set which I mentioned below

  6. I start the MySQL service from Windows services

  7. I write in the command line

    mysql -u root -p
    EnterPassword: 123 // 123 was the password

  8. The command line shows the following error

    Access denied for user 'root@localhost' (using password:**YES**)

How do I solve this?

starball's user avatar

starball

22.1k8 gold badges47 silver badges285 bronze badges

asked Jun 8, 2010 at 5:53

Nasser Hadjloo's user avatar

Nasser HadjlooNasser Hadjloo

12.3k15 gold badges69 silver badges100 bronze badges

4

for this kind of error; you just have to set new password to the root user as an admin. follow the steps as follows:

[root ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:NO)
  1. Stop the service/daemon of mysql running

     [root ~]# service mysql stop   
     mysql stop/waiting
    
  2. Start mysql without any privileges using the following option;
    This option is used to boot up and do not use the privilege system of MySQL.

     [root ~]# mysqld_safe --skip-grant-tables &
    

At this moment, the terminal will seem to halt. Let that be, and use new terminal for next steps.

  1. enter the mysql command prompt

     [root ~]# mysql -u root
     mysql> 
    
  2. Fix the permission setting of the root user ;

     mysql> use mysql;
     Database changed
     mysql> select * from  user;
     Empty set (0.00 sec)
     mysql> truncate table user;
     Query OK, 0 rows affected (0.00 sec)
     mysql> flush privileges;
     Query OK, 0 rows affected (0.01 sec)
     mysql> grant all privileges on *.* to root@localhost identified by 'YourNewPassword' with grant option;
     Query OK, 0 rows affected (0.01 sec)
    

*if you don`t want any password or rather an empty password

    mysql> grant all privileges on *.* to root@localhost identified by '' with grant option;
    Query OK, 0 rows affected (0.01 sec)*
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

Confirm the results:

    mysql> select host, user from user;
+-----------+------+
| host      | user |
+-----------+------+
| localhost | root |
+-----------+------+
1 row in set (0.00 sec)
  1. Exit the shell and restart mysql in normal mode.

     mysql> quit;
     [root ~]# kill -KILL [PID of mysqld_safe]
     [root ~]# kill -KILL [PID of mysqld]
     [root ~]# service mysql start
    
  2. Now you can successfully login as root user with the password you set

      [root ~]# mysql -u root -pYourNewPassword 
      mysql> 
    

Ryan M's user avatar

Ryan M

18.5k31 gold badges67 silver badges75 bronze badges

answered May 29, 2014 at 2:37

user2977819's user avatar

8

You can reset your root password. Have in mind that it is not advisable to use root without password.

answered Jun 8, 2010 at 5:54

Bozho's user avatar

BozhoBozho

589k146 gold badges1060 silver badges1140 bronze badges

4

Use mysql -u root -p
It will ask for password, insert password and enter.

answered May 16, 2019 at 11:10

Vikash Kumar's user avatar

2

1) You can set root password by invoking MySQL console. It is located in

C:\wamp\bin\mysql\mysql5.1.53\bin by default.

Get to the directory and type MySQL. then set the password as follows..

    > SET PASSWORD FOR root@localhost = PASSWORD('new-password');

2) You can configure wamp’s phpmyadmin application for root user by editing

C:\wamp\apps\phpmyadmin3.3.9\config.inc.php 

Note :- if you are using xampp then , file will be located at

C:\xampp\phpMyadmin\config.inc.php

It looks like this:

        $cfg['Servers'][$i]['verbose'] = 'localhost';
        $cfg['Servers'][$i]['host'] = 'localhost';
        $cfg['Servers'][$i]['port'] = '';
        $cfg['Servers'][$i]['socket'] = '';
        $cfg['Servers'][$i]['connect_type'] = 'tcp';
        $cfg['Servers'][$i]['extension'] = 'mysqli';
        $cfg['Servers'][$i]['auth_type'] = 'config';
        $cfg['Servers'][$i]['user'] = 'root';
        $cfg['Servers'][$i]['password'] = 'YOURPASSWORD';
        $cfg['Servers'][$i]['AllowNoPassword'] = false;

The error «Access denied for user ‘root@localhost’ (using password:NO)»
will be resolved when you set $cfg['Servers'][$i]['AllowNoPassword'] to false

If you priviously changed the password for ‘root@localhost’, then you have to do 2 things to solve the error «Access denided for user ‘root@localhost'»:

  1. if [‘password’] have a empty quotes like ‘ ‘ then put your password between quotes.
  2. change the (using password:NO) to (using password:YES)

This will resolve the error.

Note: phpmyadmin is a separate tool which comes with wamp.
It just provide a interface to MySQL. if you change my sql root’s password, then you should change the phpmyadmin configurations. Usually phpmyadmin is configured to root user.

Andreas's user avatar

Andreas

6,4472 gold badges35 silver badges46 bronze badges

answered Dec 25, 2012 at 8:35

yellobird's user avatar

yellobirdyellobird

2793 silver badges3 bronze badges

2

I was getting the same error on OS X El captain.
Mysql version 5.7 . I was able to connect to mysql with root after executing these steps.

Stop the mysql server

sudo mysql.server stop

Start mysql in safe mode

sudo mysqld_safe --skip-grant-tables

Using mysqld, Change the database to mysql and update the details for user ‘root’.

show databases;
use mysql;
UPDATE mysql.user 
    SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
    WHERE User = 'root' AND Host = 'localhost';
exit;

After that kill the ‘mysqld_safe’ process and start mysql normally. You should be able to login to mysql using root and new password. SQL docs for more details

answered Jul 5, 2016 at 10:54

Sushantkumar M's user avatar

Simply edit my.ini file in C:\xampp\mysql\bin path. Just add:

skip-grant-tables

line in between lines of # The MySQL server [mysqld] and port=3306. Then restart the MySQL server.

Looks like:

Screenshot

Stephen Rauch's user avatar

Stephen Rauch

48k31 gold badges107 silver badges136 bronze badges

answered Mar 16, 2018 at 0:19

Ryan Oscar's user avatar

Ryan OscarRyan Oscar

2791 gold badge4 silver badges20 bronze badges

1

For some information I’ve get error after changing password:

Access denied for user ‘root’@’localhost’ (using password: NO)

Access denied for user ‘root’@’localhost’ (using password: YES)

In both cases there was error.

But the thing is after that I’ve tried it with

mysql -uroot -ppassword instead of

mysql -u root -p password -> with spaces between -uroot and -ppassword so maybe if someone get trouble can try this way.

Community's user avatar

answered Mar 1, 2020 at 18:39

profiile_samir's user avatar

Make sure the MySQL service is running on your machine, then follow the instructions from MySQL for initially setting up root (search for ‘windows’ and it will take you to the steps for setting up root):

Securing the Initial MySQL Account

Kuro Neko's user avatar

answered Jun 8, 2010 at 5:56

sholsapp's user avatar

sholsappsholsapp

15.6k10 gold badges50 silver badges67 bronze badges

3

Another solution if someone gets the error The specified password for user account ‘root’ is not valid, or failed to connect to the database server also with the right password, is the follow

•In the Windows registry, delete the mysql_pwd reg key under HKCU\Software\Microsoft\WebPlatformInstaller

•Unistall older version of MySQL .NET connector

•Download and install the latest MySql .NET Connector.

answered Apr 5, 2014 at 18:50

Silverstorm's user avatar

SilverstormSilverstorm

15.4k2 gold badges38 silver badges52 bronze badges

1

  1. Change the password from config.inc.php present in C:\xampp\phpMyAdmin.
  2. Type mysql -u root -p in the command prompt.
  3. You will be asked to enter the password. Enter that password which you updated in the config.inc.php.

double-beep's user avatar

double-beep

5,04617 gold badges33 silver badges41 bronze badges

answered May 19, 2020 at 15:39

user12682744's user avatar

1

In your code replace the ‘root’ with your Server username and password with your server password.
For example if you have DB and your php files on the server http://www.example.com
then obviously you would have to enter into this server site using your username and password.

answered Jun 22, 2015 at 19:21

Pir Fahim Shah's user avatar

Pir Fahim ShahPir Fahim Shah

10.5k1 gold badge82 silver badges81 bronze badges

For MySQL 5.7. These are the below steps:

Stop your MySQL server completely. This can be done by accessing the Services window inside Windows XP and Windows Server 2003, where you can stop the MySQL service.

Open your MS-DOS command prompt using «cmd» inside the Run window. Inside it navigate to your MySQL bin folder, such as C:\MySQL\bin using the cd command.

Execute the following command in the command prompt: mysqld.exe -u root —skip-grant-tables

Leave the current MS-DOS command prompt as it is, and open a new MS-DOS command prompt window.

Navigate to your MySQL bin folder, such as C:\MySQL\bin using the cd command.

Enter mysql and press enter.

You should now have the MySQL command prompt working. Type use mysql; so that we switch to the «mysql» database.

Execute the following command to update the password:

update user set authentication_string=password(‘1111′) where user=’root’;

answered Dec 1, 2016 at 2:30

Katie's user avatar

KatieKatie

4527 silver badges18 bronze badges

0

Some times it just happens due to installation of Wamp or changing of password options of root user.
One can use privilages—>root (user) and then set password option to NO to run the things without any password OR set the password and use it in the application.

Pieter Goosen's user avatar

answered Feb 5, 2015 at 8:07

Sayyad's user avatar

If you are using XAMPP just go to C:\xampp\phpMyAdmin and then open config.inc.php find $cfg['Servers'][$i]['password'] = '' line and put your password there.

answered Aug 4, 2018 at 6:22

Ajay Rawat's user avatar

Ajay RawatAjay Rawat

3073 silver badges10 bronze badges

if you changed the port to non standard one, then you need to specify it:

$connection = mysqli_connect('localhost:3308', 'root', '', 'loginapp');

Kuro Neko's user avatar

answered May 21, 2020 at 18:54

Mitchell Yuen's user avatar

It happens because of the security reason.

try with the following

mysql -u root -p    

click enter and enter the password and try again

answered Apr 27, 2021 at 8:30

janadari ekanayaka's user avatar

0

If the root account exists but has no password, connect to the server as root using no password, then assign a password. This was my situation when I encountered this issue.

Connect to the server as root using no password:

$> mysql -u root --skip-password

Assign a password:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password';

I was able to solve my problem this way. Hope this helps someone who encounters a similar issue in the future. Cheers!

Reference: https://dev.mysql.com/doc/refman/8.0/en/default-privileges.html

answered Jan 9, 2022 at 17:10

K M Rakibul Islam's user avatar

K M Rakibul IslamK M Rakibul Islam

33.8k13 gold badges90 silver badges110 bronze badges

This means that the user has no access. This can be fixed in the following ways

make sure the host is set to ´%´

 insert into mysql.user (Host, User, Password) VALUES ('%', 'root', password('setyourpasswordhere'));
    GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;

or if you are using SQL workbench, you can create an user under

Administration —> users and privileges —> click on Add account button and create a new user, with hosts as % and grant the privileges in Administrative roles, schema privileges tabs.

enter image description here

wibeasley's user avatar

wibeasley

5,0103 gold badges34 silver badges62 bronze badges

answered Mar 10 at 10:36

Ramya Musunuru's user avatar

mysqladmin -u root -p password

enter your current password

then

enter your new password

0bserver07's user avatar

0bserver07

3,4001 gold badge28 silver badges56 bronze badges

answered Oct 7, 2013 at 16:26

djrconcepts's user avatar

djrconceptsdjrconcepts

6355 silver badges6 bronze badges

2

This “access denied” error is one of the most common errors you’ll get when working with MySQL.

Learn how to fix it, and see a range of solutions if the suggested fix does not work, in this article.

When you try to connect to a MySQL database on your own computer (called “localhost”), you may get this error:

Access denied for user 'root'@'localhost' (using password: YES)

You might get an error code in front of it:

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

You might also get the error with “using password no”:

Access denied for user 'root'@'localhost' (using password: NO)

You’ll see this if you log into MySQL using the command line:

mysql -u root -p

You might also see this if you log in to MySQL using an IDE such as MySQL Workbench. Or even if you use phpMyAdmin.

What does this mean? How can you fix it?

There are a few solutions to this, which I’ve detailed below. Try one, and if it doesn’t work, try another one.

Also a tip for logging in: don’t enter your password in the command line itself, because this will be stored in your command history. Use the -p option, as mentioned above, and then you’ll be prompted to enter the password.

Solution 1: Sudo then Change Password

If you get the “access denied” error, one way to solve it is by using sudo to log in to mysql and change the root password.

Step 1: Open the command line on your system.

Step 2: Open mysql using the sudo command:

sudo mysql

Step 3: Enter the password for this account.

Step 4: Change the auth_plugin to mysql_native_password, and the password for the root account, in a single command:

ALTER USER 'root'@'localhost'
IDENTIFIED WITH mysql_native_password BY 'your_new_password';

Substitute the word your_new_password with a new secure password that you want to use for the root account.

The mysql_native_password method is a traditional method of authentication and will allow you to login.

Step 5: Flush the privileges, which tells the server to refresh the grant tables and apply your changes, with this command:

FLUSH PRIVILEGES;

Step 6: You can confirm that the new authentication method, or plugin, is used by selecting from the mysql.user table.

SELECT user, plugin
FROM mysql.user

Results:

user plugin
root mysql_native_password

Step 7: Exit the console by pressing CTRL + D or typing exit.

exit;

Step 8: Log in to mysql using the root account and the new password you set, which should work:

mysql -u root -p

You should now be logged in to the root account in mysql.

Solution 2: Edit My.cnf File

If the above solution did not work, you may need to edit the mysql.cnf file to allow for changes to the root account.

Step 1: Open the my.cnf file. This may be stored in:

/etc/my.cnf
/etc/mysql/my.cnf

If you’re not sure where it is, search your MySQL installation folder (e.g. on Windows or Mac) for the file.

If you don’t have a my.cnf file (MacOS does not include one by default). You can create one in the /etc folder if you like.

Step 2: Add the word skip-grant-tables under the word [mysqld]. Your file may look like this:

[mysqld]
skip-grant-tables

Step 3: Restart the MySQL server.

Step 4: Login to the root account:

mysql -u root -p

Step 5: Flush the privileges, which tells the server to refresh the grant tables and apply your changes, with this command:

FLUSH PRIVILEGES;

Step 6: Set a new password for the account:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';

Substitute the word your_new_password with a new secure password that you want to use for the root account.

Step 7: Open the my.cnf file you opened in step 1, and remove the line about skip-grant-tables, and save the file.

Step 8: Restart the MySQL server again.

Step 9: Log in to the root account again:

mysql -u root -p

You should now be able to log in successfully with your new password and not get an error.

Conclusion

Either of these two solutions should hopefully solve the problem for you, and you should no longer get the error “Access denied for user ‘root’@’localhost’”.

If you have any questions, feel free to use the comments section below.

grep 'temporary password' /var/log/mysqld.log
Sort date (newest date)

You may see something like this;

[root@SERVER ~]# grep 'temporary password' /var/log/mysqld.log
2016-01-16T18:07:29.688164Z 1 [Note] A temporary password is generated for root@localhost: O,k5.marHfFu
2016-01-22T13:14:17.974391Z 1 [Note] A temporary password is generated for root@localhost: b5nvIu!jh6ql
2016-01-22T15:35:48.496812Z 1 [Note] A temporary password is generated for root@localhost: (B*=T!uWJ7ws
2016-01-22T15:52:21.088610Z 1 [Note] A temporary password is generated for root@localhost: %tJXK7sytMJV
2016-01-22T16:24:41.384205Z 1 [Note] A temporary password is generated for root@localhost: lslQDvgwr3/S
2016-01-22T22:11:24.772275Z 1 [Note] A temporary password is generated for root@localhost: S4u+J,Rce_0t
[root@SERVER ~]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password:

If you see it says

... Failed! Error: Your password does not satisfy the current policy requirements
That means your password needs to have a character such as ! . # - etc...
mix characters well, upper case, lower case, ! . , # etc...

New password: 

Re-enter new password: 
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : Y

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
Success.

All done! 
[root@SERVER ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.10 MySQL Community Server (GPL)

Watch the last 10 minutes of this video, it teaches you how you do it.

There are many similar questions, but none of them helped me.

I had been using MySQL on Windows with root/root credentials for a while, but since lately, I’m not able to login

> mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

> mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

> mysql -uroot -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

> mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I’ve tried to reset root password: (in admin console)

> cat C:\mysql-init 
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

> mysqld --init-file=C:\mysql-init --console

but there is an error line:

2015-12-17T10:34:14.616701Z 1 [ERROR] 1131  You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords

asked Dec 17, 2015 at 10:40

pacholik's user avatar

pacholikpacholik

1411 gold badge1 silver badge8 bronze badges

Ok, I started mysqld with --skip-grant-tables option. After that, I was able to connect using mysql client and reset my password with

mysql> FLUSH PRIVILEGES;

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

answered Dec 18, 2015 at 7:53

pacholik's user avatar

pacholikpacholik

1411 gold badge1 silver badge8 bronze badges

Enable skip-grant-tables in my.ini and restart MySQL. Now root can login without password so that you can reset your password:

update mysql.user set password=password('newpassword') where user='root';

dezso's user avatar

dezso

30.7k13 gold badges98 silver badges144 bronze badges

answered Dec 17, 2015 at 15:40

Rajesh's user avatar

$ mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

ODBC user is the default username under windows even if you didn’t create that user at setup time then it will show you this error message.

$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Based on the information

I had been using MySQL on Windows with root/root credentials

This is expected behavior since user root has password but you did not enter it.

$ mysql -uroot -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

$ mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

You will get this error when you enter wrong password.

To reset your root password:

1) if you have another Admin user login by using it then execute the following command:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

2) if you don’t have another administrator user follow the steps in the following URL: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

answered Dec 17, 2015 at 11:05

Ahmad Abuhasna's user avatar

Ahmad AbuhasnaAhmad Abuhasna

2,6664 gold badges23 silver badges36 bronze badges

5

I’ve found that sometimes, especially when I have more than one MySQL instance installed on a machine, I get similar errors, unless I explicitly specify the port (with -P) and/or host (with -h). Try this:

mysql -uroot -p -P3306 -h127.0.0.1

Substituting the actual port (check my.ini if you don’t know) of course.

In this case, it is possible that your password has not changed, does not need to be reset, etc. Try using your old, formerly functional root password with this login string.

answered Dec 18, 2015 at 21:56

Redbeard011010's user avatar

Summary: The MySQL Error typically occurs when you have to set out access to your MySQL database through WordPress. The request will be denied if the server doesn’t think you are authorized to perform the action. Maybe you are using the wrong password or you have the required permissions. So, there are plenty of ways to fix the MySQL error 1045 (28000). In this blog post, we will talk about the verified solutions to resolve MySQL error 1045. Additionally, we have the MySQL Database Recovery software which is a prominent tool to recover corrupted MySQL databases. Along with this, we take a look at some restrictions for which users want to resolve this error. Let’s get started. Download Now   Purchase Now

What is MySQL Error 1045 (28000)

MySQL is a relational database management system that stores and provides access to data points that are related to one another. MySQL uses Structured Query Language to add, access, and manage content in a database. However, many times MySQL error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) appears.

Reasons for MySQL Error 1045 (28000)

In MySQL, the error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) can appear because of the following reasons:

  1. When the host is not the admin.
  2. It might happen that the user does not exist on the server.
  3. Recheck the Login credentials: username and password.

So, here I will explain how to fix the error by providing a solution to the given problems. After that, I will justify the query using a utility.

Fixing the Error 1045 (28000): Access Denied for User ‘root’@’localhost’ (using password: YES) on Windows

Now, we will look into the problem-solving steps for the reasons stated above. Follow the methods given below:

1. When the Host is Not the Admin

The issue 1045 access denied for user localhost’ (using password: YES) can also occur when a person is trying to log in from another device. Try to log in from the same device in which you were earlier using the MySQL service.

2. The User Does Not Exist on the Server

The user may not exist on the same server that your MySQL is using. This can cause the error: Access denied for user ‘root’@’localhost’ (using password: YES). So, to solve the issue user must be on the MySQL server.

3. Recheck the Login Credentials: Username and Password

While Login to the MySQL server users may encounter the given error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES). This could mean that the password that you entered is wrong, so, to resolve the issue, follow the steps below:

  • Open /etc/mysql/my.cnf path from the SSH Server.
  • Then add the skip-grant-tables [mysqld] section.

Note: There is no other way to log in besides skip-grant tables. So, anyone can log in from anywhere and can do anything on the database. Skip-grant-tables is a dangerous option. So, we will remove this at the end.

  • Restart, MySQL service using the command: service mysql restart

So, now when you log in, ‘skip-grant-tables’ is configured in MySQL.

  • Log in to MySQL using: the MySQL -u root command.
  • Then, flush the privileges by using: mysql> flush privileges;
  • Here you can set a new password using the command: UPDATE user SET

Password=PASSWORD (‘my_password’) where USER=‘root’;

FLUSH PRIVILEGES;

  • After that, remove the skip-grant-tables section from /etc/mysql/my.cnf
  • At last, restart and log in to the MySQL service using the new password.

You can check your error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) is now fixed.

4. Grant Privileges

This error can also occur when there are no global privileges provided. So, to add the privileges use the given command:

GRANT ALL PRIVILEGES ON THE database.* TO ‘user’@‘localhost;’

Now, you can check your status for the error. If the error is still not resolved, then you must use the MySQL Database Recovery tool. In the next section, I will brief you on insights into this utility.

MySQL Database Recovery Utility to Recover MySQL Database

MySQL Database Recovery is a prominent tool to recover corrupted MySQL databases. Using the MySQL Database Recovery software, you can restore all your database objects such as views, tables, triggers, and more. Users can recover data from InnoDB and My ISAM engines with ease. The software maintains data integrity throughout the recovery process of corrupt SQL databases using smart algorithms. MySQL database recovery software can also solve MySQL error 1146 table doesn’t exist.

Conclusion

So, this was the MySQL error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES). I have provided quick solutions to fix the error. Work becomes hard when such errors appear and cause trouble while Logging. So, follow all the steps to resolve the error. Moreover, mentioned a quick solution to recover MySQL database using (MySQL Database Recovery) tool. It helps to maintain data integrity throughout the recovery process. To recover from such issues in future preferences. The utility will help you to fix MySQL error 1045.

Related Post

  • Mypublicwifi как настроить на windows 10
  • Mypal для windows xp русификация
  • Mypal для windows vista 32 bit
  • Mypal rus для windows xp
  • Myiptv player windows 10 скачать