Home > Database > Mysql Tutorial > body text

PHP 连接 unix_socket MySQL

WBOY
Release: 2016-06-07 16:41:34
Original
1510 people have browsed it

当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';? 
Copy after login

到:

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

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template