错误 #1045 - 无法登录 MySQL 服务器 -> phpmyadmin
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13357561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error # 1045 - Cannot Log in to MySQL server -> phpmyadmin
提问by SilverLight
We have installed PHPMyAdmin on a windows machine running IIS 7.0.
We are able to connect to MySQL using command-line, But we are not able to connect using PHPMyAdmin.
The error displayed is: Error #1045 Cannot log in to the MySQL server.
Can somebody please help?
我们已经在运行 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
PHP Version 5.4.0
mysqlnd 5.0.10 - 20111026 - $Revision: 323634 $
phpMyAdmin-3.5.4-rc1-all-languages.7z
EDIT :
I followed the link below with no success, mean i changed that password but phpmyadmin still has that error...
C.5.4.1.1. Resetting the Root Password: Windows Systems
编辑:
我按照下面的链接没有成功,这意味着我更改了密码,但 phpmyadmin 仍然有那个错误......
C.5.4.1.1。重置根密码:Windows 系统
Also there is thread like below in stack with no help :
Random error: #1045 Cannot log in to the MySQL server
but that error is not random -> i always have that error...
在没有帮助的情况下,堆栈中还有如下线程:
随机错误:#1045 无法登录 MySQL 服务器,
但该错误不是随机的 -> 我总是有那个错误...
And this is config.inc.php file in phpmyadmin folder:
这是 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();
?>
where part of these codes should i change?
我应该更改这些代码的哪些部分?
Thanks.
谢谢。
回答by Jerry Nettrouer II
In Linux I resolve this problem by going to the root command prompt type:
在 Linux 中,我通过进入 root 命令提示符类型来解决这个问题:
# mysqladmin -u root password 'Secret Phrase Here'
Then go back and login. Works every time!
然后返回并登录。每次都有效!
回答by 000
You need to do two additional things after following the link that you have mentioned in your post:
按照您在帖子中提到的链接后,您还需要做两件事:
One have to map the changed login cridentials in phpmyadmin's config.inc.php
必须在 phpmyadmin 的config.inc.php 中映射更改的登录凭据
and second, you need to restart your web and mysql servers..
其次,您需要重新启动您的 web 和 mysql 服务器..
php version is not the issue here..you need to go to phpmyadmininstallation directory and find file config.inc.php
and in that file put your current mysql password at line
php版本不是这里的问题..你需要去phpmyadmin安装目录并找到文件config.inc.php
并在该文件中将你当前的mysql密码放在行
$cfg['Servers'][$i]['user'] = 'root'; //mysql username here
$cfg['Servers'][$i]['password'] = 'password'; //mysql password here
回答by Aqueel
If you are installing first time then please try login with username and password as root
如果您是第一次安装,请尝试以 root 用户名和密码登录
回答by ItamarBe
another thing that worked for me after everything didn't - change "localhost" in config.inc.php to 127.0.0.1
在一切都没有之后对我有用的另一件事 - 将 config.inc.php 中的“localhost”更改为 127.0.0.1
回答by sjas
In mysql 5.7 the auth mechanism changed, documentation can be found in the official manual here.
在 mysql 5.7 中,身份验证机制发生了变化,文档可以在此处的官方手册中找到。
Using the system root user (or sudo
) you can connect to the mysql database with the mysql 'root' user via CLI.
All other users will work, too.
使用系统 root 用户(或sudo
),您可以通过 CLI 使用 mysql 'root' 用户连接到 mysql 数据库。所有其他用户也可以使用。
In phpmyadmin however, all mysql users will work, but not the mysql 'root' user.
然而,在 phpmyadmin 中,所有 mysql 用户都可以工作,但 mysql 'root' 用户不行。
This comes from here:
这来自这里:
$ mysql -Ne "select Host,User,plugin from mysql.user where user='root';"
+-----------+------+-----------------------+
| localhost | root | auth_socket |
| hostname | root | mysql_native_password |
+-----------+------+-----------------------+
To 'fix' this security feature, do:
要“修复”此安全功能,请执行以下操作:
mysql -Ne "update mysql.user set plugin='mysql_native_password' where User='root' and Host='localhost'; flush privileges;"
More on this can also be found herein the manual.
更多关于这也可以发现这里的说明书中无。
回答by MeVimalkumar
For ubuntu users, your config.inc.php file should be like this
对于 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'] = '';
回答by carl dallo
When you change your passwords in the security tab, there are two sections, one above and one below. I think the common mistake here is that others try to log-in with the account they have set "below" the one used for htaccess, whereas they should log in to the password they set on the above section. That's how I fixed mine.
当您在安全选项卡中更改密码时,有两个部分,一个在上面,一个在下面。我认为这里的常见错误是其他人尝试使用他们设置的“低于”用于 htaccess 的帐户登录,而他们应该使用他们在上面部分设置的密码登录。我就是这样修好我的。
回答by alan
a number of answers; check out this one also; make sure that no instance of mysql is running, always brought by not ending your sessions well. get the super user rights with
一些答案;也看看这个;确保没有 mysql 实例正在运行,这总是由于没有很好地结束您的会话而带来的。获得超级用户权限
sudo su
须藤须
and type your password when prompted to (remember nothing appears when you type your password, so, don't worry just type it and press enter). Next go to your terminal and stop all mysql instances:
并在提示时输入您的密码(请记住,输入密码时不会出现任何内容,因此,不要担心只需输入密码并按回车键即可)。接下来转到您的终端并停止所有 mysql 实例:
/etc/init.d/mysql stop
/etc/init.d/mysql 停止
after that, go and restart the mysql services (or restart xampp as a whole). This solved my problem. All the best.
之后,去重启mysql服务(或者重启xampp作为一个整体)。这解决了我的问题。祝一切顺利。
回答by IAM_AL_X
If you logged into "phpmyadmin", then logged out, you might have trouble attempting to log back in on the same browser window. The logout sends the browser to a URL that looks like this:
如果您登录“phpmyadmin”,然后注销,您可能无法尝试在同一浏览器窗口中重新登录。注销将浏览器发送到如下所示的 URL:
http://localhost/phpmyadmin/index.php?db=&token=354a350abed02588e4b59f44217826fd&old_usr=tester
But for me, on Mac OS X in Safari browser, that URL just doesn't want to work. Therefore, I have to put in the clean URL:
但对我来说,在 Safari 浏览器的 Mac OS X 上,该 URL 只是不想工作。因此,我必须输入干净的 URL:
http://localhost/phpmyadmin
Don't know why, but as of today, Oct 20, 2015, that is what I am experiencing.
不知道为什么,但截至今天,2015 年 10 月 20 日,这就是我所经历的。
回答by user6154517
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;