Parameter description for connecting to MySQL code using PHP _ PHP Tutorial

Source: Internet
Author: User
Tags mysql code
Parameters for connecting to MySQL code using PHP. The code is as follows :? Php $ linkmysql_connect (localhost, root, 123456); if (! $ Link) echo no connection successful !; Elseecho connection successful !;? The red part of the code is as follows:

$ Link = mysql_connect ("localhost", "root", "123456 ");
If (! $ Link) echo "no connection successful! ";
Else echo "connection successful! ";
?>
The red part can be modified based on your actual situation.

Localhost: indicates the database location. If it is a local machine, enter localhost. if it is on another machine, enter an IP address.
Root: enter the username of the database. The default username of MySQL is root.
123456: password corresponding to the user name. Modify the numbers according to the administrator password.
Of course, the code mentioned above is successful only after Apache + MySQL + PHP is configured. Please note.
By Sunec
Original load: Cenus Blog
Copyright. The author and original source and this statement must be indicated in the form of links during reprinting.

Why :? Php $ link = mysql_connect ("localhost", "root", "123456"); if (! $ Link) echo "no connection successful! "; Elseecho" connection successful! ";? The red part can be based on your own real...

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.