phpMyAdmin 无法连接到 MySQL 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23883163/
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
phpMyAdmin cannot connect to MySQL server
提问by Jasmine Ziz
I really need help to fix this error, because next Monday is my final year project presentation, please. I don't know how to fix this.
我真的需要帮助来修复这个错误,因为下周一是我最后一年的项目演示,拜托了。我不知道如何解决这个问题。
I've try to follow this http://www.ishaanrawat.com/solved-wampserver-1045-access-denied-for-user-rootlocalhost-using-password-no/instruction, but I get the same error.
我尝试按照此http://www.ishaanrawat.com/solved-wampserver-1045-access-denied-for-user-rootlocalhost-using-password-no/指令进行操作,但出现相同的错误。
And, a few minute ago, I uninstall wamp sever, in hope after installing it again, I can use my wamp server normally, but still the same error.
而且,几分钟前,我卸载了wamp sever,希望再次安装后,我可以正常使用我的wamp服务器,但仍然出现同样的错误。
Below is the error:
下面是错误:
MySQL said: Documentation
MySQL 说: 文档
1045 - Access denied for user 'root'@'localhost' (using password: NO)
1045 - 用户 'root'@'localhost' 的访问被拒绝(使用密码:NO)
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.
phpMyAdmin 尝试连接 MySQL 服务器,服务器拒绝连接。您应该检查配置中的主机、用户名和密码,并确保它们与 MySQL 服务器管理员提供的信息相对应。
回答by Tiep Phan
You can watch to solve your problem
http://www.youtube.com/watch?v=BgcW4h6ZAro&t=7m21s
p/s: this is Vietnamese video :)
in config.inc.php
you edit folowing code:
您可以观看以解决您的问题
http://www.youtube.com/watch?v=BgcW4h6ZAro&t=7m21s
p/s:这是越南视频 :)
在config.inc.php
您编辑以下代码时:
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
//uncomment this
$cfg['Servers'][$i]['auth_type'] = 'cookie';
//comment this
//$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;
then exit wampserver, reopen wampserver, open PHPMyadmin, you'll show login form :)
然后退出wampserver,重新打开wampserver,打开PHPMyadmin,你会显示登录表单:)
回答by Ankit Shubham
This worked for me. Prior to installing WAMP, I had MySQL installed in my computer. The password required to open the MySQL command line client was, let's say "pw". Now, after installing WAMP, it gave the same error as your when I tried to open phpMyAdmin. How to fix this:
这对我有用。在安装 WAMP 之前,我在我的计算机中安装了 MySQL。打开 MySQL 命令行客户端所需的密码是“pw”。现在,在安装 WAMP 后,当我尝试打开 phpMyAdmin 时,它给出了与您相同的错误。如何解决这个问题:
- Open C:\wamp\apps\phpmyadmin4.1.14\config.inc.php
Locate these lines:
$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;Change "
$cfg['Servers'][$i]['AllowNoPassword'] = true;
" to "$cfg['Servers'][$i]['AllowNoPassword'] = false;
".Change "
$cfg['Servers'][$i]['password'] = ''
" to "$cfg['Servers'][$i]['password'] = 'pw'
". (Remember to put your password instead of 'pw
' ).Restart all services in WAMP and try opening phpMyAdmin again. Hope it works now!
- 打开 C:\wamp\apps\phpmyadmin4.1.14\config.inc.php
找到这些行:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['服务器'][$i]['密码'] = '';
/* 服务器参数/
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/如果您的服务器没有 mysqli,请选择 mysql */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;将“
$cfg['Servers'][$i]['AllowNoPassword'] = true;
”改为“$cfg['Servers'][$i]['AllowNoPassword'] = false;
”。将“
$cfg['Servers'][$i]['password'] = ''
”改为“$cfg['Servers'][$i]['password'] = 'pw'
”。(请记住输入您的密码而不是“pw
”)。重新启动 WAMP 中的所有服务并再次尝试打开 phpMyAdmin。希望它现在有效!
回答by Abu Sufian
Go to phpMyAdmin folder inside of XAMPP or WAMPS server and open config.inc.php file. And Change username and password to set in your db.
转到 XAMPP 或 WAMPS 服务器内的 phpMyAdmin 文件夹并打开 config.inc.php 文件。并更改用户名和密码以在您的数据库中设置。
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
回答by Sandeepa Rajoriya
u first change the "AllowNoPassword" value to false in config.inc.php. then set password for root then login to phpmyadmin.
u 首先在 config.inc.php 中将“AllowNoPassword”值更改为 false。然后为root设置密码,然后登录phpmyadmin。
回答by Vedant Jain
The solution is:
解决办法是:
Backup All your projects and database first.
Uninstall
lampp
from your system (Ubuntu 16.04).Re-install
lampp
.Open
phpmyadmin
. The error has not been removed yet.Open
config.inc.php
ofphpmyadmin
folder.Make changes to these lines:
/* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'your password';
首先备份所有项目和数据库。
lampp
从您的系统 (Ubuntu 16.04) 中卸载。重新安装
lampp
。打开
phpmyadmin
。错误尚未消除。打开
config.inc.php
的phpmyadmin
文件夹中。对这些行进行更改:
/* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'your password';
Now save the file (if unable to save then write):
sudo -H gedit /opt/lampp/phpmyadmin/config.inc.php
Restart your
xampp
server.Go to
localhost/phpmyadmin
again. Try to login withroot
as username and leave the passwords filed blank. If this doesn't works then login with the password you have entered.
现在保存文件(如果无法保存则写入):
sudo -H gedit /opt/lampp/phpmyadmin/config.inc.php
重新启动您的
xampp
服务器。再去
localhost/phpmyadmin
。尝试使用root
用户名登录并将密码字段留空。如果这不起作用,请使用您输入的密码登录。
Good Luck!
祝你好运!
回答by alok
Remove xampp and install mysql,phpmyadmin,php5, apache2 manully.
删除 xampp 并手动安装 mysql、phpmyadmin、php5、apache2。
sudo su
apt-get install mysql-server mysql-client
apt-get install apache2
apt-get install php5 libapache2-mod-php5
apt-cache search php5
Pick the ones you need and install them like this:apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
apt-get install phpmyadmin
service apache2 restart
- then open
http://127.0.0.1/phpmyadmin/
sudo su
apt-get install mysql-server mysql-client
apt-get install apache2
apt-get install php5 libapache2-mod-php5
apt-cache search php5
选择您需要的并像这样安装它们:apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
apt-get install phpmyadmin
service apache2 restart
- 然后打开
http://127.0.0.1/phpmyadmin/
These upper commands will make your xampp server. It will resolve your problem quickly and worked very smoothly. thanks to related articles:
这些上层命令将使您的 xampp 服务器。它将快速解决您的问题并且工作非常顺利。感谢相关文章: