Mysql_real_escape_string to use/tmp/mysql. sock to connect to the database? -Php Tutorial

Source: Internet
Author: User
Do I need to connect to the database when using this function? How do I specify the address of the mysql server used to connect to the database? Currently, mysqlserver is connected to the local machine. do you need to install a mysqlserver on every machine running php? Or modify the tmpmys .. function on all machines. do you need to connect to the database when using this function? How do I specify the address of the mysql server used to connect to the database? Currently, the mysql server is connected to the local machine. do you need to install a mysql server on every machine running php? Or modify/tmp/mysql. sock on all machines? This is strange.

Reply content:

Do I need to connect to the database when using this function? How do I specify the address of the mysql server used to connect to the database? Currently, the mysql server is connected to the local machine. do you need to install a mysql server on every machine running php? Or modify/tmp/mysql. sock on all machines? This is strange.

You do not need to use the/tmp/mysql. sock connection. you only need a connection id created with mysql_connect or mysql_pconnect.

Why not use mysql_escape_string?

Of course, you need to connect to the database. mysql. sock is automatically generated after mysql is connected.

When installing php, did the landlord specify that sock is required to connect to mysql? If yes, just remove it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.