【问题标题】:PHPMyAdmin access denied using wamp使用 wamp 拒绝 PHPMyAdmin 访问
【发布时间】:2015-07-01 16:36:38
【问题描述】:

当我尝试使用 PHPMyAdmin 连接我的数据库时,我现在收到此错误:

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

虽然它运行了好几个月...
事实是存在连接密码,但 PHPMyAdmin 不使用它。
我试图编辑config.inc.php

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$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'] = 'xxxx';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';


/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';

我的 phpmyadmin.conf 似乎没问题:

Alias /phpmyadmin "c:/wampserver2/apps/phpmyadmin3.5.1/" 

<Directory "c:/wampserver2/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

我不明白为什么总是说 using password: NO 而有一个定义!
我试图清除浏览器缓存/cookie,但还是一样。
还多次重新加载 Wamp...

DB密码不是很重要,因为它只在本地机器上使用,但我也未能删除mySql中的root密码。
如果我将密码设置为 '',会有一条消息说引号没有从密码中删除,所以密码不是空的,我必须与 mysql -uroot -p'' 连接(这太愚蠢了!!)

感谢您提供任何线索! :)

Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
150423 15:48:27 [Note] wampmysqld: Normal shutdown

150423 15:48:27 [Note] Event Scheduler: Purging the queue. 0 events
150423 15:48:27  InnoDB: Starting shutdown...
150423 15:48:28  InnoDB: Shutdown completed; log sequence number 2080864866
150423 15:48:28 [Note] wampmysqld: Shutdown complete

150423 15:48:28 [Note] Plugin 'FEDERATED' is disabled.
150423 15:48:28 InnoDB: The InnoDB memory heap is disabled
150423 15:48:28 InnoDB: Mutexes and rw_locks use Windows interlocked functions
150423 15:48:28 InnoDB: Compressed tables use zlib 1.2.3
150423 15:48:28 InnoDB: Initializing buffer pool, size = 128.0M
150423 15:48:28 InnoDB: Completed initialization of buffer pool
150423 15:48:28 InnoDB: highest supported file format is Barracuda.
150423 15:48:29  InnoDB: Waiting for the background threads to start
150423 15:48:30 InnoDB: 1.1.8 started; log sequence number 2080864866
150423 15:48:30 [Note] Server hostname (bind-address): '(null)'; port: 3306
150423 15:48:30 [Note]   - '(null)' resolves to '::';
150423 15:48:30 [Note]   - '(null)' resolves to '0.0.0.0';
150423 15:48:30 [Note] Server socket created on IP: '0.0.0.0'.
150423 15:48:30 [Warning] Found invalid password for user: 'toto@toto'; Ignoring user
150423 15:48:30 [Note] Event Scheduler: Loaded 0 events
150423 15:48:30 [Note] wampmysqld: ready for connections.
Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)

toto@toto 部分看起来很糟糕,但看不出它来自哪里...??

【问题讨论】:

标签: php mysql phpmyadmin


【解决方案1】:
**1 :** go to your WAMP icon on your PC desktop screen and LEFT CLICK to open the menu, you will see MYSQL folder, CLICK to see MYSQL CONSOLE, open it.

**2:** now you have DOS screen ( a black screen ) :


      --- if you already set a password, type it
      --- if you did not do this step yet, write the following red text
      --- use mysql; and click ENTER on your keyboard

**3:** now write the following red text and click ENTER :

UPDATE mysql.user
->SET Password=PASSWORD("*******")
->WHERE User="root";

do not worry about this sign ( -> ) , because for example when you write ( UPDATE mysql.user ) and you click ENTER on your keyboard, a new line appear with this sign ( -> ), your command will execute when you write this sign ( ; ) at the end of your text and click ENTER.

NOTE: replace the password ******* by your password.

**4:** now write the following red text and click ENTER :

FLUSH PRIVILEGES;

**5:** and to exit the black DOS screen now, write exit and click enter.

------------------------- we are finished from MySQL now --------------

**6:** go to WAMP folder ( open your My Computer, click on C driver, and you will see WAMP folder ), click on APPS folder, and than click on your PHPMYADMIN folder ( e.g my folder called phpmyadmin2.11.6 ) and find the config.inc.php

**7:** open config.inc.php and find the following orange text:

$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed

and add your password now that you used in step number 3 like that :

$cfg['Servers'][$i]['password'] = 'yourpasswordhere'; // MySQL password (only needed

**8:** now save this modification, and close config.inc.php

**9:** go to your web browser and type the following link :

http://localhost/phpmyadmin/107

and enjoy!!!

【讨论】:

  • 你重启服务了吗??请确保您的 mysql 密码与您在配置文件中提供的密码相同。
  • 是的,我重新启动了所有服务(通过 Wamp)...但页面仍然显示 using password: NO... 它没有显示密码错误!它说它甚至不使用密码......!看不懂……
  • 更新 phpmyadmin.conf &lt;Directory "c:/wamp/apps/phpmyadmin4.1.14/"&gt; Options Indexes FollowSymLinks MultiViews AllowOverride all &lt;IfDefine APACHE24&gt; Require local &lt;/IfDefine&gt; &lt;IfDefine !APACHE24&gt; Order Deny,Allow Deny from all Allow from localhost ::1 127.0.0.1 &lt;/IfDefine&gt; php_admin_value upload_max_filesize 128M php_admin_value post_max_size 128M php_admin_value max_execution_time 360 php_admin_value max_input_time 360 &lt;/Directory&gt;
  • 并检查 config.inc.php /* Authentication type */ $cfg['Servers'][$i]['verbose'] = 'mysql wampserver'; //$cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; /* Server parameters */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysql if your server does not have mysqli */ $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true;
  • 使用 phpmyadmin.conf,它不起作用(我只是更改了适合我的版本)...尝试 config.inc.php
【解决方案2】:

这样给予

$cfg['Servers'][$i]['password'] = '';

如果root用户的密码没有设置

删除/更改密码

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

【讨论】:

  • 有一个root密码...我没有设法删除它。 (我只能通过命令行连接)
  • 当我执行SET PASSWORD FOR 'root'@'localhost' = PASSWORD(''); 时,我得到了输出Query OK, 0 rows affected (0.00ssec)... 我仍然必须使用我的密码才能连接...。
  • 使用新密码更新并尝试使用新密码输入您的代码
  • 更新代码为 $cfg['Servers'][$i]['AllowNoPassword'] = false;
猜你喜欢
  • 1970-01-01
  • 2012-11-02
  • 2016-01-02
  • 2013-12-06
  • 2013-08-28
  • 2016-09-24
  • 2014-05-25
  • 2017-08-11
  • 2016-04-02
相关资源
最近更新 更多