phpmysqlnetwork-programmingsphinx

PHP / connection to Sphinx requires username / password


I am currently trying to connect to Sphinx via PDO or MySqli connector in order to use SphinxQL, however, although Sphinx has no username/password settings and I should be able to connect without the use of such, I get a user/pass error:

Warning: mysqli_connect(): (HY000/1045): Access denied for user ''@'localhost' (using password: NO)

My connection try is as follows (mysqli in this case:)

$con = mysqli_connect('localhost', '', '', '', '9306');

localhost above works with Mysql, I also tried 127.0.0.1 without success (this gave me a connection refused error).

My sphinx conf looks as follows:

listen          = 9306:mysql41

searchd is running, and connection via shell works as it should:

[root@localhost vagrant]# mysql -h0 -P 9306
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 Server version: 2.2.11-id64-release (95ae9a6)

As you can see above, I use Sphinx v.2.2.11

Just in case, I also re-checked the port assignments:

[root@localhost vagrant]# netstat -tulpn | grep LISTEN
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1475/master
tcp        0      0 127.0.0.1:9306          0.0.0.0:*               LISTEN      21599/searchd
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      4013/mysqld

Any help is appreciated.


Solution

  • Weird things happen sometimes, without a plausible explanation. As mentioned, I am using vagrant (Centos 7.5) on a windows 10 host. The connection would not work no matter what. After putting it to rest for the day, my PC went to "sleep" mode. The next day, after revoking the system everything worked fine. What can I say ¯_(ツ)_/¯ . Problem solved.