How can I connect to a db4free.net database with PHP?

后端 未结 4 881
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 12:05

I made a db on db4free.net, and I want to connect to it with php:

$username = myusername; 
$password = mypw; 
$host = \"db4free.net:3306\"; 
$dbname = mydbna         


        
相关标签:
4条回答
  • 2021-01-04 12:39

    This may be too late to post an answer to this question.

    But I hope this would help anyone who comes searching a solution for a connection failure or access denial just as me.

    db4free.net while having database listening on the port 3306, they provide mysql servers on some other ports as well. When creating your account make sure to keep in mind the server you selected.

    As in my case, my account was created on their newly set up mysql 8 server and it runs on the port 3307

    0 讨论(0)
  • 2021-01-04 12:45

    Don't set the port at the end of the hostname. 3306 is indeed the default port for mysql connection anyway.

    0 讨论(0)
  • 2021-01-04 12:53

    This worked for me...

    $host = "db4free.net"; 
    
    0 讨论(0)
  • 2021-01-04 12:55

    I tried using this code and it worked for me

    $host = "85.10.205.173:3306"; 
    
    0 讨论(0)
提交回复
热议问题