Home  >  Article  >  Database  >  How to test whether the database connection is successful in mysql

How to test whether the database connection is successful in mysql

coldplay.xixi
coldplay.xixiOriginal
2021-01-06 10:29:267309browse

Mysql method to test whether the database connection is successful: first open all relevant ports; then restart iis, the code is [$link = mysql_connect('localhost', 'root', '123456');].

How to test whether the database connection is successful in mysql

The operating environment of this tutorial: Windows 7 system, mysql version 8.0.22, DELL G3 computer. This method is suitable for all brands of computers.

Related free learning recommendations: mysql video tutorial

Mysql method to test whether the database connection is successful:

Test whether the database is connected successfully The connection is successful

If

Fatal error: Calltoundefinedfunctionmysql_connect() in ......”

appears, don’t panic

We will

     ;extension=php_dba.dll
      ;extension=php_gd2.dll
      ;extension=php_mbstring.dll
      ;extension=php_mcrypt.dll
      ;extension=php_mysql.dll
      ;extension=php_mysqli.dll
      ;extension=php_pdo.dll
      ;extension=php_pdo_mysql.dll
;extension=php_mbstring.dll
       ;extension=php_gd2.dll
       ;extension=php_mysql.dll
       ;extension=php_mcrypt.dll

enable all

and then restart iis. It will be successful

   
        
         连接数据库
        
        
         
        
       

The above is the detailed content of How to test whether the database connection is successful in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn