mysql一直连不上了是什么原因啊,linux上,php连不到数据库
2015/05/1213:51:52[error][exception.CDbException]exception'CDbException'withmessage'C...
2015/05/12 13:51:52 [error] [exception.CDbException] exception 'CDbException' with message 'CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2003] Can't connect to MySQL server on '192.168.10.25' (111)' in /var/www/yii-1.1.14/framework/db/CDbConnection.php:382
Stack trace:
#0 /var/www/yii-1.1.14/framework/db/CDbConnection.php(330): CDbConnection->open()
#1 /var/www/yii-1.1.14/framework/db/CDbConnection.php(308): CDbConnection->setActive(true)
#2 /var/www/yii-1.1.14/framework/base/CModule.php(387): CDbConnection->init()
#3 /var/www/yii-1.1.14/framework/base/CApplication.php(450): CModule->getComponent('db')
#4 /var/www/yii-1.1.14/framework/db/ar/CActiveRecord.php(634): CApplication->getDb()
#5 /var/www/yii-1.1.14/framework/db/ar/CActiveRecord.php(667): CActiveRecord->getDbConnection()
#6 /var/www/yii-1.1.14/framework/db/ar/CActiveRecord.php(1455): CActiveRecord->getCommandBuilder()
#7 /var/www/tsbm/protected/components/UserIdentity.php(26): CActiveRecord->find('username=? AND ...', Array) 展开
Stack trace:
#0 /var/www/yii-1.1.14/framework/db/CDbConnection.php(330): CDbConnection->open()
#1 /var/www/yii-1.1.14/framework/db/CDbConnection.php(308): CDbConnection->setActive(true)
#2 /var/www/yii-1.1.14/framework/base/CModule.php(387): CDbConnection->init()
#3 /var/www/yii-1.1.14/framework/base/CApplication.php(450): CModule->getComponent('db')
#4 /var/www/yii-1.1.14/framework/db/ar/CActiveRecord.php(634): CApplication->getDb()
#5 /var/www/yii-1.1.14/framework/db/ar/CActiveRecord.php(667): CActiveRecord->getDbConnection()
#6 /var/www/yii-1.1.14/framework/db/ar/CActiveRecord.php(1455): CActiveRecord->getCommandBuilder()
#7 /var/www/tsbm/protected/components/UserIdentity.php(26): CActiveRecord->find('username=? AND ...', Array) 展开
1个回答
展开全部
您好,程序中用到了PDO对象, 连接mysql 5. 在PHP的默认设置中,只打开了php_pdo 模块, 没有打开php_pdo_mysql模块.所以才会出现找不到驱动程序的错误.
如果在linux下面,确信模块pdo_mysql.so已经编译进php。
在php.ini下面添加:
extension=pdo_mysql.so
具体的解决方案,请参考: Linux中安装PHP的PDO MySQL扩展的详细解决方案 http://www.flybi.net/article/70
如果在linux下面,确信模块pdo_mysql.so已经编译进php。
在php.ini下面添加:
extension=pdo_mysql.so
具体的解决方案,请参考: Linux中安装PHP的PDO MySQL扩展的详细解决方案 http://www.flybi.net/article/70
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询