phpMyAdmin 尝试连接 MySQL 服务器,但服务器拒绝连接 XAMPP

phpMyAdmin 尝试连接 MySQL 服务器,但服务器拒绝连接 XAMPP

你好,我打算连接 phpMyAdmin,我已经安装了 XAMPP,但我使用本指南更改了端口

无法在 Ubuntu 11.10 上启动 XAMPP

我使用此 URL 进入 phpMyAdmin,http://localhost:2145/phpmyadmin但出现以下错误

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.

我的confic.inc.php是:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['host'] = 'localhost:2145';
$cfg['Servers'][$i]['connect_type'] = 'cookie';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = '';
$cfg['Servers'][$i]['controlpass'] = '';

谢谢您的帮助

编辑

这一改变帮我解决了错误

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;

是否还需要停止 mysql 并启动 Xampp

sudo service mysql stop
/opt/lampp/lampp start

答案1

我已经在这上面浪费了两天时间。最后我找到了解决方案,手动删除xampp并安装mysqlphpmyadminphp5apache2

sudo apt-get install apache2 mysql-server mysql-client 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
sudo apt-get install phpmyadmin
sudo service apache2 restart

现在你可以打开http://127.0.0.1/phpmyadmin/

这些上面的命令将使您的 xampp 服务器。它将快速解决您的问题并且运行非常顺利。

感谢相关文章:
1.Ubuntu 14.10 LAMP 服务器教程,包含 Apache 2、PHP 5 和 MySQL(MariaDB)
2.如何更改 apache 服务器的根目录?

答案2

  1. 转到 myini 文件
  2. 将端口号编辑为 ->port = 4306
  3. 保存文件
  4. 重新启动 mySql 和 apache

原因是,您的本地计算机可能正在使用端口 3306。因此无法连接

答案3

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;

这是正确的答案

相关内容