在 phpmyadmin 中更改 Mysql Server 的端口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28193713/
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
Change Port of Mysql Server in Phpmyadmin
提问by Ferenjito
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
:
我的5.1.73-1-log
服务器上运行了两个 MySql ( )实例,一个在端口 3306(默认)上,一个在端口 3307 上。现在,我想更改 PhpMyAdmin ( 3.3.7deb7
) 以在 3307 上使用第二个实例,而不是默认一个。因此,我将以下行添加到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.
现在,虽然 PhpMyAdmin 说localhost:3307
(看截图),它访问的数据库仍然是来自在默认端口上运行的实例的数据库。
How do I change the settings in order to make the port change real?
如何更改设置以使端口更改真实?
回答by Cyril N.
From the PhpMyAdmin documentation...
从PhpMyAdmin 文档...
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']
.
如果使用 localhost 作为主机名,MySQL 会忽略此端口号并与套接字连接,因此如果要连接到与默认端口不同的端口,请使用
127.0.0.1
或 中的真实主机名$cfg['Servers'][$i]['host']
。
回答by Bima Catur Hatmoko
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';
回答by user1324491
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
首先打开 Xamppp 控制面板,点击配置按钮,在下一页点击服务和端口设置,在该页面你可以为你的所有服务设置所有端口。你也应该改变 Phpmyadmin(config.inc.php) 文件的内容如下
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port']= 'your preferred port number';