我们在运行IIS 7.0的Windows机器上安装了PHPMyAdmin
我们可以使用命令行连接到MySQL,但是我们无法使用PHPMyAdmin连接
显示的错误是:Error #1045 Cannot log in to the MySQL server.
有人可以帮忙吗?
PHP Version 5.4.0
mysqlnd 5.0.10 - 20111026 - $Revision: 323634 $
phpMyAdmin-3.5.4-rc1-all-languages.7z
编辑:
我按照下面的链接没有成功,意味着我更改了密码,但phpmyadmin仍然有错误...
C.5.4.1.1. Resetting the Root Password: Windows Systems
还有下面的线程在堆栈中没有帮助:
Random error: #1045 Cannot log in to the MySQL server
但该错误不是随机的 - >我总是有这个错误...
这是phpmyadmin文件夹中的config.inc.php文件:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Config file view and save screen
*
* @package PhpMyAdmin-setup
*/
if (!defined('PHPMYADMIN')) {
exit;
}
/**
* Core libraries.
*/
require_once './libraries/config/FormDisplay.class.php';
require_once './setup/lib/index.lib.php';
require_once './setup/lib/ConfigGenerator.class.php';
$config_readable = false;
$config_writable = false;
$config_exists = false;
check_config_rw($config_readable, $config_writable, $config_exists);
?>
<h2><?php echo __('Configuration file') ?></h2>
<?php display_form_top('config.php'); ?>
<input type="hidden" name="eol" value="<?php echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')) ?>" />
<?php display_fieldset_top('', '', null, array('class' => 'simple')); ?>
<tr>
<td>
<textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php
echo htmlspecialchars(ConfigGenerator::getConfigFile())
?></textarea>
</td>
</tr>
<tr>
<td class="lastrow" style="text-align: left">
<input type="submit" name="submit_download" value="<?php echo __('Download') ?>" class="green" />
<input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php if (!$config_writable) echo ' disabled="disabled"' ?> />
</td>
</tr>
<?php
display_fieldset_bottom_simple();
display_form_bottom();
?>
我应该改变部分代码吗?
感谢。
答案 0 :(得分:17)
在Linux中,我通过转到root命令提示符来解决此问题:
# mysqladmin -u root password 'Secret Phrase Here'
然后返回并登录。每次都有效!
答案 1 :(得分:13)
按照帖子中提到的链接后,您需要再做两件事:
必须在phpmyadmin的 config.inc.php
中映射已更改的登录cridentials第二,你需要重新启动你的web和mysql服务器..
php版本不是这里的问题..你需要去 phpmyadmin 安装目录并找到文件config.inc.php
并在该文件中将当前的mysql密码放在行
$cfg['Servers'][$i]['user'] = 'root'; //mysql username here
$cfg['Servers'][$i]['password'] = 'password'; //mysql password here
答案 2 :(得分:4)
如果您是第一次安装,请尝试使用用户名和密码登录
答案 3 :(得分:3)
在一切都没有改变之后,另一件事对我有用 - 改变&#34; localhost&#34;在config.inc.php到127.0.0.1
答案 4 :(得分:2)
在mysql 5.7中,auth机制已更改,文档可在官方手册here中找到。
使用系统root用户(或sudo
),您可以通过CLI使用mysql“root”用户连接到mysql数据库。
所有其他用户也会工作。
然而,在phpmyadmin中,所有mysql用户都可以使用,但不是mysql“root”用户。
这来自这里:
$ mysql -Ne "select Host,User,plugin from mysql.user where user='root';"
+-----------+------+-----------------------+
| localhost | root | auth_socket |
| hostname | root | mysql_native_password |
+-----------+------+-----------------------+
要“修复”此安全功能,请执行以下操作:
mysql -Ne "update mysql.user set plugin='mysql_native_password' where User='root' and Host='localhost'; flush privileges;"
有关此内容的更多信息,请参阅手册中的here。
答案 5 :(得分:1)
在安全选项卡中更改密码时,有两个部分,一个在上面,一个在下面。我认为这里常见的错误是其他人尝试使用他们在htaccess所用的“下方”设置的帐户登录,而他们应该登录他们在上一节中设置的密码。这就是我修理我的方式。
答案 6 :(得分:1)
对于ubuntu用户,你的config.inc.php文件应该是这样的
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'username';
$cfg['Servers'][$i]['password'] = 'password';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
/**
* phpMyAdmin configuration storage settings.
*/
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = '';
答案 7 :(得分:0)
如果您登录了#34; phpmyadmin&#34;,然后退出,则可能无法尝试重新登录同一浏览器窗口。注销将浏览器发送到如下所示的URL:
http://localhost/phpmyadmin/index.php?db=&token=354a350abed02588e4b59f44217826fd&old_usr=tester
但对我来说,在Safari浏览器的Mac OS X上,该网址并不想工作。因此,我必须放入干净的URL:
http://localhost/phpmyadmin
不知道为什么,但截至今天,2015年10月20日,这就是我所遇到的。
答案 8 :(得分:0)
sudo service mysql stop
sudo mysqld --skip-grant-tables &
mysql -u root mysql
Change MYSECRET with your new root password
UPDATE user SET Password=PASSWORD('MYSECRET') WHERE User='root'; FLUSH PRIVILEGES; exit;
答案 9 :(得分:0)
一些答案;还检查一下这个;确保没有运行mysql实例,总是由于无法很好地结束会话而带来的。通过
获得超级用户权限sudo su
,然后在出现提示时输入密码(请记住,输入密码时不会显示任何内容,因此,请放心输入并按Enter键。)。接下来转到终端并停止所有mysql实例:
/etc/init.d/mysql stop
之后,请重新启动mysql服务(或整体重新启动xampp)。这解决了我的问题。一切顺利。