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

前端 未结 16 857
萌比男神i
萌比男神i 2020-11-22 15:30

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 prov

相关标签:
16条回答
  • 2020-11-22 15:47

    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.

    0 讨论(0)
  • 2020-11-22 15:49

    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';

    0 讨论(0)
  • 2020-11-22 15:50

    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.

    0 讨论(0)
  • 2020-11-22 15:50
    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.
    0 讨论(0)
  • 2020-11-22 15:53

    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.

    0 讨论(0)
  • 2020-11-22 15:54

    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.

    0 讨论(0)
提交回复
热议问题