Fer*_*ito 8 mysql unix port phpmyadmin
我5.1.73-1-log在我的服务器上运行了两个MySql()实例,一个在端口3306上(默认),一个在端口3307上.现在,我想更改PhpMyAdmin(3.3.7deb7)以获取3307上的第二个实例,而不是默认值.因此,我将以下行添加到config.inc.php:
$cfg['Servers'][$i]['port'] = '3307';
Run Code Online (Sandbox Code Playgroud)
现在,虽然PhpMyAdmin说localhost:3307(看截图),但它访问的数据库仍然是来自默认端口上运行的实例的数据库.
如何更改设置以使端口更改成为现实?

小智 7
您可以更改此行:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
Run Code Online (Sandbox Code Playgroud)
用这一行:
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
Run Code Online (Sandbox Code Playgroud)
从PhpMyAdmin 文档...
如果使用 localhost 作为主机名,MySQL 会忽略此端口号并与套接字连接,因此如果要连接到与默认端口不同的端口,请使用
127.0.0.1或 中的真实主机名$cfg['Servers'][$i]['host']。