我已经在谷歌云应用引擎部署codeigniter项目.我试图通过codeigniter连接gcloud mysql.获取数据库连接问题.数据库连接示例如下-
public $default = [
'DSN' => 'mysql:dbname=db_name;unix_socket=/cloudsql/project:region:instance',
'hostname' => 'public_ip',
'username' => 'username',
'password' => 'password',
'database' => 'db_name',
'DBDriver' => 'MySQLi',
'DBPrefix' => 'tbl',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8mb4',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
];
字符串
示例的连接IP是否授权?
我得到了Main connection [MySQLi]: Connection timed out
我试过不同的方法
1条答案
按热度按时间eqqqjvef1#
我需要将hostname =>设置为私有IP,因为我不需要使用Ginstance.DSN