MySQL said: Documentation #1045 - Access denied for user 'root'@'localhost' (using password: NO)

前端 未结 20 1498
失恋的感觉
失恋的感觉 2020-11-29 02:41

I installed xampp,but when I tried to run it I got an error as thus:

Error

MySQL said: Documentation

1045 - Access denied for user \'root\'@\'localhost

相关标签:
20条回答
  • 2020-11-29 03:23

    Try this:

    1. xampp/htdocs/xampp/cds.php
    
    change line 4 to: mysql_connect("localhost","root","enter password here");
    change line 64 to: if(!mysql_connect("localhost","root","enter password here"))
    

    From here

    0 讨论(0)
  • 2020-11-29 03:24

    Try resetting your password since it seems it has changed you can reset your password by going to

    C:\xampp\mysql
    

    and clicking on the resetroot.bat file

    Then change in the php config file the password back to blank and you should have access again

    0 讨论(0)
  • 2020-11-29 03:26

    I had this same problem after I dropped the special PhpMyAdmin controluser account from MySQL.

    I had to update the config.inc.php file and replace the entries for 'controluser' and controlpass' with 'user' and 'password'.

    So my file ended like this:

    $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password']='123456';

    0 讨论(0)
  • 2020-11-29 03:28
    1. try to go to Windows services and stop the MySQL service
    2. go to your wamp server and click on "restart all services".
    3. Refrsch your browser
    0 讨论(0)
  • 2020-11-29 03:30

    I think to troubleshoot your problem you should try the following:

    1. Check whether the MySQL service is running (Control Panel --> services)
    2. Use a MySQL client like SQLYOG to check whether you are able to connect to MYSQL Server with the username and password you are using in your code.
    3. Just try a sample php program, which fetches the data from table Ex. http://www.anyexample.com/programming/php/php_mysql_example__display_table_as_html.xml
    0 讨论(0)
  • 2020-11-29 03:32

    Here's the solution to getting the 1045 Access denied for user 'root'@'localhost' (using password: NO) in phpMyAdmin.

    First here's what happens:

    The problem occurs when you change over from using phpMyAdmin with no password and mysql with no root password. You change root in mysql to having a root password. You dutifully change phpMyAdmin's config.ini.php file's $cfg['Servers'][$i]['password']='' line to include your password and restart everything you can find, but phpMyAdmin still can't get through.

    The reason is that your browser still contains cookies for phpMyAdmin and those cookies reflect not needing a password to access mysql.

    The solution:

    Clear out the cookies relating to phpMyAdmin. Its browser specific, but in my Firefox, its under Tools > Page Info > Cookies.

    You might need to relog in with phpMyAdmin or use the signon.php script (under /examples in my WAMP install).

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