mysql_connect(): No connection could be made because the target machine actively refused it

后端 未结 10 1876
长情又很酷
长情又很酷 2020-11-30 12:41

I have this problem when I am trying to run my PHP MySQL script. When I try to run my .php file this is what I get.

mysql_connect(): No connection could be m         


        
10条回答
  •  北海茫月
    2020-11-30 13:01

    It looks like you forgot to add your password to your connection. Also, you should not use mysql connect anymore as it is officially depreciated. Use MYSQLi or PDO instead. An example of this would be:

    $connection= mysqli_connect("localhost", "root", "password", "database")
    or die(mysqli_error("error connecting to database"));
    

提交回复
热议问题