4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mac上でphpMyAdminがDBに接続できない場合、UNIX socketを確認する

Last updated at Posted at 2014-01-14

設置したphpMyAdminからDBに接続できない場合、UNIX socketを確認します。

ターミナルでmysqlのstatusコマンドを使用します。

mysql> status

--------------
mysql  Ver 14.14 Distrib 5.6.15, for osx10.9 (x86_64) using  EditLine wrapper

Connection id:		2
Current database:	
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		5.6.15 Homebrew
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8
Db     characterset:	utf8
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/tmp/mysql.sock
Uptime:			24 sec

Threads: 1  Questions: 5  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.208
--------------

UNIX socketは、「/tmp/mysql.sock」となっています。

php.iniにある、mysqlとmysqliのdefault_socketに、先ほどのUNIX socketを設定します。

$ vim /etc/php.ini

[MySQL]
mysql.default_socket = /tmp/mysql.sock

[MySQLi]
mysqli.default_socket = /tmp/mysql.sock

設定後、Apacheを再起動すれば、UNIX socketが有効になり、接続できるようになります。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?