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

mysql access denied for user ''@'localhost'
mysql2::error: access denied for user 'root'@'localhost' (using password: yes)
mysql access denied for user remote
access denied for user 'root'@'localhost linux
access denied for user 'root'@'localhost' (using password no) when trying to connect
access denied for user to database 'mysql
error 1045 (28000): access denied for user
how to solve access denied for user 'root'@'localhost

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 '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? I'm waiting to hear from you.

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

mysql how to fix Access denied for user 'root'@'localhost', Follow the steps below. Start the MySQL server instance or daemon with the --​skip-grant-tables option (security setting). $ mysqld --skip-grant-tables. Execute  Access denied for user 'root'@'localhost' (using password yes) in MySQL occurs mainly due to insufficient privileges to the user.

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> 
    

MySQL remote connection, The error message indicates that you're not connecting to the remote MySQL at all, but to localhost. Make sure you connect using option -h to the remote server. For Ubuntu/Debian users. Open "mysqld.cnf" configuration file at "/etc/mysql/mysql.conf.d/". Add skip-grant-tables to the next line of [mysql] text and save. Restart mysql service as "sudo service mysql restart". Now your mysql is free of any authentication. Connect to mysql client(also known as

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.

MySQL Error: : 'Access denied for user 'root'@'localhost', To fix MySQL Error: : 'Access denied for user 'root'@'localhost', you should follow these steps: Step 1: Open and Edit /etc/my.cnf or  Issue 2: I cannot access, change, save, or delete files and folders Issue 3: I cannot open a file or folder after I upgrade to a new version of Windows Poslední aktualizace: Jul 7, 2019

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

In MySQL, how do I resolve the error "Access denied for user , mysql> GRANT ALL ON *.* to user_name@localhost IDENTIFIED BY 'password';. Replace user_name with the user's username and password  Try accesing the server with 'root'@'127.0.0.1' which is diferent from 'root'@'localhost'. Then issue a command to create the user 'root'@'localhost' and grant all privileges to it. – Gimmy Jun 3 '13 at 8:06. Also see How to have MySQL entitle the root user? on Super User. It attempts to avoid resetting passwords. – jww Apr 2 '16 at 11:28.

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):

http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html

How to Fix MySQL Error: Access denied for user root@localhost, Most MySQL users encountered the ERROR 1698 (28000): Access denied for user 'root'@'localhost'. This error message usually appears for  "Connect failed: Access denied for user 'root'@'localhost' (using password: YES)" I am able to use them on my pc (using XAMPP) and I can navigate through the tables of the database using the command line in the server. However, the webpage fails to connect. I've checked the password but with no results.

ACCESS DENIED: Reset MySQL root user password, Access denied for user 'root'@'localhost'. error, even though you're sure it's the right login. You've also already tried the official documentation  The DA supports all end-users of Drupal with infrastructure for updates and security releases, including many that are on the front-lines of the fight against COVID-19, such as the CDC, the NIH, and hospitals around the world. But in this time of uncertainty, our own finances are at risk.

1044/1045 - Access denied for user 'username , 1044/1045 - Access denied for user 'username'@'yourhost' updated at September 09, 2019 20:14. Apply OS: Windows, macOS, Linux, iOS. Apply Navicat  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) I am an electrical engineer who mainly plays around with power systems instead of programming. Recently, I have been following a manual to install a software suite on Ubuntu. I have no knowledge of mySQL at all, actually.

Fixing MySQL 1045 Error: Access Denied, So let's take a look at why the MySQL 1045 error Access Denied triggers. 3) User exists but client host does not have permission to connect:. "Connection failed: Access denied for user" cant connect to database hey guys, not sure this is the right subreddit but im just trying to make a simple connection to my database to see if it works, but i keep getting the following error: Connection failed: Access denied for user 'ttcin482'@'localhost' (using password: YES).

Comments
  • The first command is wrong, should be -p or --password, but not password. That's why mysql responds with USING PASSWORD NO.
  • Nobody seems to have given him the obvious answer. The password for the root userid is blank after the initial install. So just do mysql -u root -p and then just hit enter, i.e. leave the password blank. Then of course put a password on the root userid.
  • @RiggsFolly nope, doesn't work! blank password gives me access denied!
  • I want add a comment as I am not sure the accepted answer is the correct one. For me typing mysql -u root -p and then once prompt for the password, give the right one(the one set at installation) worked. Instead proving the name of a DB to the -p with a DB I know exist did not worked.
  • @Bozho - I follow the instruction aand create a text file and call it from the mentioned command, after that I face with 100608 [warning] --default-character-set is deprecated and will be removed in a future release. please use --character-set-server instead .-------------------------------- and finally when I start my mysql service again I face withthe exact error but this time with (using password:yes) what should I do?
  • @Bozo - Note that I couldn't run your command with mysqldt-nt I run it by mysqldt -nt Actuallythe first one is not recognizable for cmd. I'm waiting to hear from you.
  • @Bozho - I've update my question with the bug. thank you for your time.
  • @Bozho - is there a way to update / customise my mysql errors? **Update "Access denied for user 'root@localhost' (using password:NO)" to "Access denied for user 'myname@localhost' (using password:NO)" **
  • Press Enter after "[root ~]# mysqld_safe --skip-grant-tables &" and open another terminal to enter "[root ~]# mysql -u root"
  • i met this problem, and i did alot, just forget restarting the db services... many thanks!