0
votes

I'm using a MySQL 5 server and want to connect over MySQLi.

If I connect using mysql_connect, all works fine, but with MySQLi I got the following message:

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2005): Unknown MySQL server host 'localhost:/tmp/mysql5.sock' (1) in /XXX.php on line 129
Cannot connect to database.

On another server, MySQLi works without any problems. Any ideas?

2
It's a shame there's a 15 character limit on comments. I only meant to write one word: "Code?" - Madara's Ghost
Yes, please! Show us the exact code that you use (with censored passwords, o'course) for both cases. - TehShrike
Hi, thanks for your answer, you can see the class here : svn.contentlion.org/… If you remove the @, you got the message. - Stefan Wienströer

2 Answers

1
votes

Try localhost:3306 instead of Unix socket ?

1
votes

I got the solution over Facebook!

I have to set ini_set('mysqli.default_so​cket', '/tmp/mysql5.sock'); and use just localhost as host.

Thanks anyway!