Php: Configuring mysql and how to test database configuration success _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Php configures mysql and how to test the database configuration. If you need to configure mysql in php and test and configure the database successfully, refer. If you are configuring phpmysqlapache for the first time, you can refer to how to test whether php is successfully connected to the database and how to configure mysql and how to test and configure the database.

If you are configuring php mysql apache for the first time, how can we test that php is successfully connected to the database? just create a test. php file and save the following code to the file.

The code is as follows:

$ Link = mysql_connect ("localhost", "root", "12345"); // change 12345 to your mysql password.
If (! $ Link) echo "failed! ";
Else echo "successful! ";
Mysql_close ();
?>

Open http: // localhost/test. php in the browser

If you enter

If the configuration is successful, it indicates that the configuration is successful. if the configuration fails, we can go to mysql_connect ("localhost", "root", "12345") or die (mysql_error ()); in this way, an error message is displayed.

If the mysql_connect function is not defined

; Extension = php_mysql.dll
; Extension = php_mysqli.dll

Move the previous one.

Extension = php_mysql.dll
Extension = php_mysqli.dll

Restart apache.

For more information, see. If you are configuring php mysql apache for the first time, how can we test that php is successfully connected to the database...

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.