MySQL 使用标志时连接被拒绝
MySQL connection refused when using a flag
所以,当我尝试在没有标志的情况下创建连接时,它工作正常。
$db_init_conn = mysqli_init();
$db_conn = mysqli_real_connect($db_init_conn, HOSTNAME, DBUSERNAME, DBPASSWORD,DATABASE);
但是当我这样使用flag的时候
$db_init_conn = mysqli_init();
$db_conn = mysqli_real_connect($db_init_conn, HOSTNAME, DBUSERNAME, DBPASSWORD,DATABASE,$flags=MYSQLI_CLIENT_INTERACTIVE);
我知道了
Warning: mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
我做错了什么?
更新
当我使用其他标志时也会发生
$mysqli = mysqli_init();DBPASSWORD,DATABASE);
$db_conn = mysqli_real_connect($mysqli, HOSTNAME, DBUSERNAME, DBPASSWORD,DATABASE, $flags=MYSQLI_CLIENT_COMPRESS);
所以,快速安装 mysqli 在我的盒子上,这没有给我任何错误
$db_init_con = mysqli_init();
mysqli_real_connect($db_init_con , "127.0.0.1" , "***REDACTED***" , "***REDACTED***" , "notifications" , 3306 ,null , MYSQLI_CLIENT_INTERACTIVE);
与 mysql 5.7,php 7.2.6,osx
所以,当我尝试在没有标志的情况下创建连接时,它工作正常。
$db_init_conn = mysqli_init();
$db_conn = mysqli_real_connect($db_init_conn, HOSTNAME, DBUSERNAME, DBPASSWORD,DATABASE);
但是当我这样使用flag的时候
$db_init_conn = mysqli_init();
$db_conn = mysqli_real_connect($db_init_conn, HOSTNAME, DBUSERNAME, DBPASSWORD,DATABASE,$flags=MYSQLI_CLIENT_INTERACTIVE);
我知道了
Warning: mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
我做错了什么?
更新
当我使用其他标志时也会发生
$mysqli = mysqli_init();DBPASSWORD,DATABASE);
$db_conn = mysqli_real_connect($mysqli, HOSTNAME, DBUSERNAME, DBPASSWORD,DATABASE, $flags=MYSQLI_CLIENT_COMPRESS);
所以,快速安装 mysqli 在我的盒子上,这没有给我任何错误
$db_init_con = mysqli_init();
mysqli_real_connect($db_init_con , "127.0.0.1" , "***REDACTED***" , "***REDACTED***" , "notifications" , 3306 ,null , MYSQLI_CLIENT_INTERACTIVE);
与 mysql 5.7,php 7.2.6,osx