php 我在 XAMPP 中更改了 MySQL 端口,现在如何监听新端口?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28807338/
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
I changed MySQL port in XAMPP, now how do I listen to the new port?
提问by Charas
I have installed the latest XAMPP with MySQL version 14.14 Distrib 5.6.21, the problem is in my computer, I already have a MySQL database installed by other program that I am using.
我已经安装了最新的 XAMPP 和 MySQL 版本 14.14 Distrib 5.6.21,问题出在我的电脑上,我已经有一个由我正在使用的其他程序安装的 MySQL 数据库。
So I configure the XAMPP MySQL port to 3307 (default is 3306) inside the my.ini
file. However, now my localhost/phpmyadmin seems to read the database installed by the other program, not the one in XAMPP, and also when I test using some PHP files, it shows that I am connected to the database even though XAMPP is turned off (XAMPP MySQL also disconnected ).
所以我在my.ini
文件中将 XAMPP MySQL 端口配置为 3307(默认为 3306)。但是,现在我的 localhost/phpmyadmin 似乎读取了其他程序安装的数据库,而不是 XAMPP 中的数据库,而且当我使用某些 PHP 文件进行测试时,即使 XAMPP 已关闭,它也显示我已连接到数据库( XAMPP MySQL 也断开连接)。
How do I change the setting of my phpmyadmin and localhost to connect to the mysql port 3307 ?
如何更改 phpmyadmin 和 localhost 的设置以连接到 mysql 端口 3307?
I am a newbie in these matters and don't really understand how all these port and database works very clearly. Any comments are welcomed. Hope that anyone could educate me a little on these matters. Thx in advance
我是这些问题的新手,并不太清楚所有这些端口和数据库是如何工作的。欢迎提出任何意见。希望任何人都可以在这些问题上对我有所教育。提前谢谢
回答by Pradeep Rajput
Goto xampp>phpMyAdmin
Directory.
转到xampp>phpMyAdmin
目录。
Find the config.inc.php
file.
找到config.inc.php
文件。
Now change this line:
现在改变这一行:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
To
到
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
回答by Isaac Bennetch
To configure phpMyAdmin to connect to a different port from the default, edit your config.inc.php
file and add a line like:
要将 phpMyAdmin 配置为连接到默认端口不同的端口,请编辑您的config.inc.php
文件并添加如下一行:
$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['port'] = '3307';
(of course substituting any port number as needed). You can also see the official documentation.
(当然可以根据需要替换任何端口号)。您还可以查看官方文档。
回答by Tariq Ali
The following worked for me, I just added my port code to:
以下对我有用,我只是将我的端口代码添加到:
$cfg['Servers'][$i]['host'] = '127.0.0.1:3308';
$cfg['Servers'][$i]['host'] = '127.0.0.1:3308';