mysql_real_escape_string 要使用 /tmp/mysql.sock 连接数据库?

WBOY
Release: 2016-06-06 20:46:49
Original
818 people have browsed it

这个函数在使用的时候,需要连接数据库吗?怎么样指定他链接数据库时候使用的mysql服务器地址?目前是连接本机的mysql server,难道需要在每个运行php的机器上都装一个mysql server?或者修改所有机器上的/tmp/mysql.sock?这个很奇怪啊

回复内容:

这个函数在使用的时候,需要连接数据库吗?怎么样指定他链接数据库时候使用的mysql服务器地址?目前是连接本机的mysql server,难道需要在每个运行php的机器上都装一个mysql server?或者修改所有机器上的/tmp/mysql.sock?这个很奇怪啊

不一定要用 /tmp/mysql.sock 连接,只是需要一个用 mysql_connect 或者 mysql_pconnect 建立的连接标识就可以

为什么不用 mysql_escape_string ?

当然需要连接数据库,mysql.sock是在mysql连接后自动生成的

楼主是不是在安装php的时候指定了连接mysql必须要用sock啊?如果是去掉就好了。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!