The following error message is displayed: Warning: mysqli_connect (): Response. Headers: 50625 Library: 50541insrvpmatest. phponline8Warning: mysqli_connect () :( HY0002002): Ca... the following error message is displayed:
Warning: mysqli_connect (): Headers and client library minor version mismatch. Headers: 50625 Library: 50541 in/srv/pma/test. php on line 8
Warning: mysqli_connect (): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2) in/srv/pma/test. php on line 8
I am in php. mysql. default_socket =/var/mysql. sock. I don't know why I couldn't find the socket in this file. I can use the command line to connect to mysql and set the password. What is the problem?
Reply content:
The following error message is displayed:
Warning: mysqli_connect (): Headers and client library minor version mismatch. Headers: 50625 Library: 50541 in/srv/pma/test. php on line 8
Warning: mysqli_connect (): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2) in/srv/pma/test. php on line 8
I am in php. mysql. default_socket =/var/mysql. sock. I don't know why I couldn't find the socket in this file. I can use the command line to connect to mysql and set the password. What is the problem?
The host of your php database should use localhost. In this case, you will use the socket method to connect to the database.
The socket file path in the error message is inconsistent with that in your php. ini file.
Conjecture 1. You may have modified php. ini, but did not restart php-fpm.
Conjecture 2. php may exist in multiple paths on your machine. ini, but php-fpm does not load the php you modified. ini. you can write a page and use phpinfo to confirm your php. ini path.
In addition, please check the specified socket path of mysqld section in your mysql configuration file my. cnf.
Several configuration items about MySQL Socket in php. ini:
Mysql. default_socket corresponds to mysql Functions
Mysqli. default_socket corresponds to mysqli series Functions
Pdo_mysql.default_socket corresponds to pdo_mysql series Functions
We do not recommend that you use the MySQL connection information in php. ini. We recommend that you directly specify the socket or Port location in mysqli_connect:
$mysqli = mysqli_connect( null, // $app['db_host'], $app['db_username'], $app['db_password'], $app['db_name'], null, // $app['db_port'] $app['db_socket']);