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

前端 未结 16 1004
萌比男神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: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.

提交回复
热议问题