简体   繁体   English

如何通过 Unix 套接字将 PhpMyAdmin 连接到本地主机?

[英]How to connect with PhpMyAdmin to the localhost via a Unix socket?

Can someone help with connecting to my web server?有人可以帮助连接到我的网络服务器吗?

In phpMyAdmin database is Server: localhost:3306 when click on it I get:在 phpMyAdmin 数据库是Server: localhost:3306当点击它时我得到:

Server: Localhost via UNIX socket
Server type: MySQL
Server version: 5.5.52-cll - MySQL Community Server (GPL)

So how I can connect on it without an address or an IP?那么我如何在没有地址或 IP 的情况下连接它呢?

The PhpMyAdmin and the MySQL run on the same, non-local system. PhpMyAdmin 和 MySQL 在同一个非本地系统上运行。

Probably You wanted this:可能你想要这个:

$socket = '/var/run/mysqld.sock'; // or: /tmp/mysqld.sock
$db = new mysqli('localhost', 'username', 'password', "database", 3306, $socket);
// $db = mysql_connect('localhost:'.$socket, 'username', 'password');

in config.inc.php, instead of在 config.inc.php 中,而不是

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

set设置

$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM