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...