Home >Backend Development >PHP Tutorial >Code sharing to test whether PHP connection to MySQL is successful_PHP tutorial
In many cases we don’t know whether it is a PHP error or an incorrect mysql username and password that causes cms operation errors. You can test it with the following code first
The method is simple: Save the following code as test.php, put it in the web directory and execute it. The code is as follows: The parameters of the mysql_connect() function are: mysql server name or IP, mysql user name, and mysql user password.