Access denied for user '[email protected]' (using password:NO)

I'm new to MySQL, 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 '[email protected]' (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 '[email protected]' (using password:**YES**)

How do I solve this? I'm waiting to hear from you.

Solutions

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

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 [email protected] 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 [email protected] 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> 
    

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 [email protected] = 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 '[email protected]' (using password:NO)" will be resolved when you set $cfg['Servers'][$i]['AllowNoPassword'] to false

If you priviously changed the password for '[email protected]', then you have to do 2 things to solve the error "Access denided for user '[email protected]'":

  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.

Similar questions

mysql_query(): Access denied for user ''@'localhost' (using password: NO)
I'm running a cron job in my WordPress site and getting these two errors Warning: mysql_query(): A link to the server could not be established in /home/geekda6/public_html/wp-content/plugins/maxblogpress-ninja-affiliate/ninja-affiliate-library/include/mbp-ninja-affiliate.cls.php on line 251 Warning: mysql_query(): Access denied for user ''@'localho...
Wordpress - mysql_query(): Access denied for user 'www-data'@'localhost' (using password: NO) error on production server
I'm getting a warning message when I enable wordpress debug mode. Warning: mysql_query(): Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/html/blog/wp-content/plugins/test/manage_registrations.php on line 46 Warning: mysql_query(): A link to the server could not be established in /var/www/html/blog/wp-content/plugins/...
Access denied for user ''@'localhost' (using password: NO) When Upgrading Wordpress
I just tried to upgrade the latest wordpress version, and it throws this error. Access denied for user ''@'localhost' (using password: NO) . I immediately communicated it to the service provider, they say it is a database error. But i checked the wp-config file with correct database name, username and password, It is all perfect. But why still im g...
showing ERROR 1045 (28000): Access denied for user 'naveen'@'localhost' (using password: NO) in ubuntu 16.04 ?
It shows error when trying to execute command mysql on terminal. but it works for sudo mysql, and not showing any error message for it. i tried reinstalling mysql. but still the problem is there. hence i can't able to access the root account.
mysqli_real_connect(): (HY000/1045): Access denied for user 'admin'@'localhost' (using password: YES) wordpress
im getting this error when im trying to connect to the database in my wordpress site ? i set my wp_debug to ture then this message showed up i found some info about this topic but it wasn't like my issue - and i didn't get a satisfying answers Erorr In line 1635 Full Error Alert Message im using Please if you have any idea how to fix this tell me o...
Warning: mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost' - Docker
I'm attempting to bring a Docker image of Wordpress up with supervisor only struggling. The code is from a reputable source: https://github.com/how2dock/docbook/tree/master/ch01/supervisor Here's my Dockerfile and a portion of my wp-config.php supervisord.conf Build the container; docker build -t wordpress . and run the webserver with docker run -d...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.