Skip to content

Commit

Permalink
修复数据库连接配置问题,使用username指定用户名
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Aug 23, 2018
1 parent 2a1127b commit 5577734
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/Db/Drivers/CoroutineMysql/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Driver implements IDb
* 参数格式:
* [
* 'host' => 'MySQL IP地址',
* 'user' => '数据用户',
* 'username' => '数据用户',
* 'password' => '数据库密码',
* 'database' => '数据库名',
* 'port' => 'MySQL端口 默认3306 可选参数',
Expand All @@ -57,9 +57,13 @@ class Driver implements IDb
public function __construct($option = [])
{
$this->option = $option;
if(!isset($this->option['username']))
if(isset($this->option['username']))
{
$this->option['username'] = 'root';
$this->option['user'] = $this->option['username'];
}
else
{
$this->option['user'] = 'root';
}
if(!isset($option['password']))
{
Expand Down
2 changes: 1 addition & 1 deletion src/Db/Drivers/PdoMysql/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Driver implements IDb
* 参数格式:
* [
* 'host' => 'MySQL IP地址',
* 'user' => '数据用户',
* 'username' => '数据用户',
* 'password' => '数据库密码',
* 'database' => '数据库名',
* 'port' => 'MySQL端口 默认3306 可选参数',
Expand Down

0 comments on commit 5577734

Please sign in to comment.