更改phpMyAdmin中MySQL Server的端口

发布于 2025-01-27 17:22:09 字数 468 浏览 5 评论 0 原文

我有两个在我的服务器上运行的mySQL( 5.1.73-1-log )的实例,一个在端口3306上(默认值),一个在端口3307上。现在,我想更改phpmyadmin( 3.3.7deb7 )要在3307上进行第二个实例,而是默认一个实例。 因此,我将以下行添加到 config.inc.php

    $cfg['Servers'][$i]['port'] = '3307';

现在,尽管phpmyadmin说 localhost:3307 (查看屏幕截图),但它访问的数据库仍然是来自在默认端口上运行的实例。

如何更改设置以使端口更改实现?

“在此处输入图像说明”

I have two instances of MySql (5.1.73-1-log) running on my server, one on port 3306 (default), one on port 3307. Now, I want to change PhpMyAdmin (3.3.7deb7) to take the second instance, on 3307, instead the default one.
Thus, I add the following line to config.inc.php:

    $cfg['Servers'][$i]['port'] = '3307';

Now, though PhpMyAdmin says localhost:3307 (look Screenshot), the databases that it accesses are still those from the instance that runs on the default port.

How do I change the settings in order to make the port change real?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

故事与诗 2025-02-03 17:22:09

您可以更改此行:

$cfg['Servers'][$i]['host'] = '127.0.0.1';

使用此行:

$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';

You can change this line:

$cfg['Servers'][$i]['host'] = '127.0.0.1';

with this line:

$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
メ斷腸人バ 2025-02-03 17:22:09

来自 phpmyadmin文档 ...

如果使用localhost作为主机名,则mySQL忽略此端口号并与套接字连接,因此,如果要连接到与默认端口不同的端口,请使用> 127.0.0.0.1 $ cfg ['server'] [$ i] ['host']

From the PhpMyAdmin documentation...

If you use localhost as the hostname, MySQL ignores this port number and connects with the socket, so if you want to connect to a port different from the default port, use 127.0.0.1 or the real hostname in $cfg['Servers'][$i]['host'].

若沐 2025-02-03 17:22:09

首先打开XAMPPP控制面板单击配置按钮,在下一页上单击服务和端口设置,在该页面上,您可以为所有服务设置所有端口。
另外,您应该更改phpmyadmin(config.inc.php)文件的内容如下

$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['port']= 'your preferred port number';

first open Xamppp Control Panel click on Config Button, at the next page click on Services and Port Settings, at that page you can set all ports for all of your services.
also you should change content of Phpmyadmin(config.inc.php) file as below

$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
$cfg['Servers'][$i]['port']= 'your preferred port number';
所谓喜欢 2025-02-03 17:22:09

不知何故,连接到Localhost会自动通过套接字连接而不是端口连接(默认3306)的陈述似乎不是正确的。我安装了几台用于测试的服务器,在我的phpmyadmin页面中,我在Topline中看到了其中的一些服务器:“服务器:localhost”,在其他我看到的“服务器:localhost:3306”中。我猜想没有端口号的一个是通过套接字连接的,而其他端口号是通过IP端口3306连接的。我仍在寻找如何配置它。在我看来,脚本config.inc.php不是一个地方。我怀疑这是一些.conf或.cnf或.ini文件,但我尚未找到哪个文件。

Somehow the statement that connecting to localhost automatically connects through socket rather than port (default 3306) does not seem to be true. I have several servers installed for testing and in my phpMyAdmin page of some of them I see in the topline: "server: localhost" and in others I see "server: localhost:3306". I am guessing that the one without the port number is connected through socket and the others are through IP port 3306. I am still looking how to configure that. It seems obvious to me that the script config.inc.php is not the place to be. I suspect it is some .conf or .cnf or .ini file but I am yet to find which one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文