How do I tell DBD::mysql where mysql.sock is?

前端 未结 2 1312
攒了一身酷
攒了一身酷 2021-02-20 10:23

Using DBD::mysql with DBI, I am getting the following error when attempting to connect to the database.

DBI connect(\'database=mydb:host=localhost\',\'someuser\'         


        
2条回答
  •  不要未来只要你来
    2021-02-20 10:56

    $dbh=DBI->connect("DBI:mysql:database=dbname;mysql_socket=/var/lib/mysql/mysql.sock;user=username;password=password");
    

    You don't need to specify host since you're connecting to a socket file.

提交回复
热议问题