修复端口在非3306时php think install的BUG

pull/282062/MERGE
Karson 2017-05-08 13:06:53 +08:00
parent 862f93ce88
commit 3c642a3a79
1 changed files with 1 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class Install extends Command
// 先尝试能否自动创建数据
$config = Config::get('database');
$pdo = new PDO("{$config['type']}:host={$config['hostname']}", $config['username'], $config['password']);
$pdo = new PDO("{$config['type']}:host={$config['hostname']}" . ($config['hostport'] ? ";port={$config['hostport']}" : ''), $config['username'], $config['password']);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->query("CREATE DATABASE IF NOT EXISTS `{$config['database']}` CHARACTER SET utf8 COLLATE utf8_general_ci;");