Mysql/Mysqli Connection Test under Wamp (SQL Safe Mode)

To test mysql/mysqli connection of localhost, we will save the php script below as name phpmysql.php, and then place to the root localhost and run in browser:

But there is issue as below

mysql_connect(): SQL safe mode in effect – ignoring host/user/password information in [path]/adodb- on line 339

It is because that if sql.safe_mode is enabled, mysql_connect() and mysql_pconnect() ignore any arguments passed to them. Instead, PHP attempts to connect using the following details, so all the mysql connect functions will fail.

  • host: localhost
  • user: the user PHP runs as
  • password: an empty string (“”)

The solution is that turn OFF the sql.safe_mode

  1. Open php.ini
  2. Search keyword: sql.safe_mode
  3. When you find the below:[SQL]
  4. Change sql.safe_mode = ON to be Off. Done!

One thought on “Mysql/Mysqli Connection Test under Wamp (SQL Safe Mode)

Leave a Reply

Your email address will not be published. Required fields are marked *