数据库访问出错 [ 2.0 版本 ]
在本地和测试服务器上运行没有问题,在将测试服务器所有内容复制到生产服务器后出现数据库连接错误下面是出错信息
2015-09-08 16:12:32 [115.198.131.186][-][-][error][yii\db\Exception] exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'laiqian_root'@'10.164.29.218' (using password: YES)' in /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Connection.php:579
Stack trace:
#0 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Connection.php(579): PDO->__construct('mysql:host=rdst...', 'root', 'jq2&8=7m+', NULL)
#1 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Connection.php(529): yii\db\Connection->createPdoInstance()
#2 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Connection.php(836): yii\db\Connection->open()
#3 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Connection.php(823): yii\db\Connection->getMasterPdo()
#4 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Command.php(208): yii\db\Connection->getSlavePdo()
#5 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Command.php(815): yii\db\Command->prepare(true)
#6 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Command.php(350): yii\db\Command->queryInternal('fetchAll', NULL)
#7 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/mysql/Schema.php(198): yii\db\Command->queryAll()
#8 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/mysql/Schema.php(97): yii\db\mysql\Schema->findColumns(Object(yii\db\TableSchema))
#9 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/Schema.php(139): yii\db\mysql\Schema->loadTableSchema('t_shop')
#10 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/ActiveRecord.php(297): yii\db\Schema->getTableSchema('t_shop')
#11 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/ActiveRecord.php(320): yii\db\ActiveRecord::getTableSchema()
#12 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/ActiveRecord.php(179): yii\db\ActiveRecord::primaryKey()
#13 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/db/BaseActiveRecord.php(101): yii\db\ActiveRecord::findByCondition('235360', true)
#14 /home/wwwroot/default/pos/posweb2/controllers/ShopController.php(185): yii\db\BaseActiveRecord::findOne('235360')
#15 /home/wwwroot/default/pos/posweb2/controllers/ShopController.php(15): app\controllers\ShopController->findShop('235360')
#16 [internal function]: app\controllers\ShopController->actionIndex('235360')
#17 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#18 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#19 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('index', Array)
#20 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('shop/index', Array)
#21 /home/wwwroot/default/pos/posweb2/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#22 /home/wwwroot/default/pos/posweb2/web/index.php(51): yii\base\Application->run()
#23 {main}
共 4 个回答
心雨
注册时间:2015-07-23
最后登录:2020-03-31
在线时长:20小时35分
最后登录:2020-03-31
在线时长:20小时35分
- 粉丝5
- 金钱175
- 威望20
- 积分575