简体   繁体   中英

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:

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?

The PhpMyAdmin and the MySQL run on the same, non-local system.

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

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

set

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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