php: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it

后端 未结 6 1646
暖寄归人
暖寄归人 2020-12-20 02:33

I have create register and login form using php. And i had took the source from google.

So i have added all the corresponding code, when run index.php.

It sh

6条回答
  •  一个人的身影
    2020-12-20 03:25

    I suffered this error too. I did following things: 1. find out the port number used by mysql. In phpmyadmin, I ran the following sql:

    show variables;
    

    it shows a list of variables of mysql. scroll down, you will find port number.

    1. I edited the php code like this:

    $dsn = 'mysql:host=127.0.0.1;port=3307; dbname=learnphpfast';

    it worked like a charm!

提交回复
热议问题