MySQL said: Documentation #1045 - Access denied fo

2019-01-13 13:10发布

i install xampp,but when i try to run it i got error said that like this :

Error

MySQL said: Documentation

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

Connection for controluser as defined in your configuration failed. phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

i try search in internet for solution, but i still can't fix my problem. I already check whether i used password or not in config.inc.php file. but i do not have use any password. and when i try put password, i still can't solve this problem.

i hope anyone can help me. .thank you

20条回答
\"骚年 ilove
2楼-- · 2019-01-13 13:30

Go to file C:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php

Find the line $cfg['Servers'][$i]['password']='' and change this to

$cfg['Servers'][$i]['password']='root' where root is the name of the password you had set in this instance

Hope this helps somebody.

查看更多
成全新的幸福
3楼-- · 2019-01-13 13:31

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

查看更多
\"骚年 ilove
4楼-- · 2019-01-13 13:31
  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
查看更多
Summer. ? 凉城
5楼-- · 2019-01-13 13:32

My.ini from the file #password and #bind-address="127.0.0.1" are commented change the password to root and uncomment bind-address="127.0.0.1" and from the file cds.php change the

mysql_connect("localhost", "root", ""); to
mysql_connect("localhost", "root", "root");

Stop the Mysql services and try login again it got logged in.

查看更多
姐就是有狂的资本
6楼-- · 2019-01-13 13:37

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

查看更多
Anthone
7楼-- · 2019-01-13 13:38

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
查看更多
登录 后发表回答