MySQL在没有套接字文件的情况下运行 [英] MySQL is running without a socket file
本文介绍了MySQL在没有套接字文件的情况下运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在MacOSX 10.7.3中安装了MySQL.
I've installed MySQL to my MacOSX 10.7.3.
看起来MySQL正在运行:
It looks like MySQL is running:
Radeks-MacBook-Pro:htdocs radeksimko$ mysql5
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
我需要能够从PHP访问MySQL,因此我尝试运行示例文件:
I need to be able to access MySQL from PHP, so I tried to run sample file:
<?php
mysql_connect( "localhost", "user", "pass" );
但是我有这个:
Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /usr/htdocs/index.php on line 4
我将在php.ini中设置mysql.default_socket,但是我真的无法在任何地方找到套接字文件...
I would set the mysql.default_socket in php.ini, but I'm really unable to find the socket file anywhere...
应该在哪里放置/如何找到它? 这什么也没发现:
Where it should be placed/how could I find it? This found nothing:
Radeks-MacBook-Pro:~ radeksimko$ sudo find / -name mysql.sock 2>/dev/null
推荐答案
看看
- 无法在Mac上连接到MySQL- -缺少mysql.sock文件
- http://maccrazy .com/lion-upgrade-killed-my-php-site-and-how-i-fixed-it
- Can't connect to MySQL on Mac -- missing mysql.sock file
- http://maccrazy.com/lion-upgrade-killed-my-php-site-and-how-i-fixed-it
这篇关于MySQL在没有套接字文件的情况下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文