Heim  >  Artikel  >  Datenbank  >  PHP 连接 unix_socket MySQL

PHP 连接 unix_socket MySQL

WBOY
WBOYOriginal
2016-06-07 16:41:341474Durchsuche

当MySQL使用Unix Socket启动时,直接使用localhost会发生了一个数据库错误,发生无法连接数据库错误。 Warning: mysql_connect() [function.mysql-connect]: [2002] 这时应当修改hostname,例如在CI 配置数据库 (database.php) 从: $db['default']['hostnam

当MySQL使用Unix Socket启动时,直接使用localhost会发生了一个数据库错误,发生无法连接数据库错误。

Warning: mysql_connect() [function.mysql-connect]: [2002]

这时应当修改hostname,例如在CI 配置数据库 (database.php) 从:

 $db['default']['hostname']?=?'localhost';? 

到:

$db['default']['hostname']?=?'localhost:/Applications/mamp/mysql/tmp/mysql.sock';

php connect unix socket mysql

(...)
Read the rest of PHP 连接 unix_socket MySQL (47 words)


© Li Xi for LixiPHP, 2014. | Permalink | No comment | Add to del.icio.us
Post tags: CI, drupal, MySQL, unix_socket

Feed enhanced by Better Feed from Ozh

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:max-allowed-packetNächster Artikel:升级php请求等待响应时间变长