Cannot connect to MySQL with mysqli extension Print

  • 27

Check this tips if you want to connect to MySQL using the PHP mysqli extension:

  1. Make sure the mysqli extension is included by using the php -i CLI command or the phpinfo() function in a script accessible through the web.
  2. Make sure the php.ini setting mysqli.default_socket points to the mysql sock files, usually /var/lib/mysql/mysql.sock
  3. After making changes to php.ini remember to restart your web server

Was this answer helpful?

« Back