<i id='fgmFB'><tr id='fgmFB'><dt id='fgmFB'><q id='fgmFB'><span id='fgmFB'><b id='fgmFB'><form id='fgmFB'><ins id='fgmFB'></ins><ul id='fgmFB'></ul><sub id='fgmFB'></sub></form><legend id='fgmFB'></legend><bdo id='fgmFB'><pre id='fgmFB'><center id='fgmFB'></center></pre></bdo></b><th id='fgmFB'></th></span></q></dt></tr></i><div id='fgmFB'><tfoot id='fgmFB'></tfoot><dl id='fgmFB'><fieldset id='fgmFB'></fieldset></dl></div>
      <bdo id='fgmFB'></bdo><ul id='fgmFB'></ul>

      <tfoot id='fgmFB'></tfoot>

      <small id='fgmFB'></small><noframes id='fgmFB'>

      <legend id='fgmFB'><style id='fgmFB'><dir id='fgmFB'><q id='fgmFB'></q></dir></style></legend>

      在 yii2 中迁移时出现异常“找不到驱动程序"

      时间:2023-10-16

      <small id='13eTv'></small><noframes id='13eTv'>

      • <tfoot id='13eTv'></tfoot>
          <tbody id='13eTv'></tbody>
        <i id='13eTv'><tr id='13eTv'><dt id='13eTv'><q id='13eTv'><span id='13eTv'><b id='13eTv'><form id='13eTv'><ins id='13eTv'></ins><ul id='13eTv'></ul><sub id='13eTv'></sub></form><legend id='13eTv'></legend><bdo id='13eTv'><pre id='13eTv'><center id='13eTv'></center></pre></bdo></b><th id='13eTv'></th></span></q></dt></tr></i><div id='13eTv'><tfoot id='13eTv'></tfoot><dl id='13eTv'><fieldset id='13eTv'></fieldset></dl></div>

              <bdo id='13eTv'></bdo><ul id='13eTv'></ul>

              <legend id='13eTv'><style id='13eTv'><dir id='13eTv'><q id='13eTv'></q></dir></style></legend>
              • 本文介绍了在 yii2 中迁移时出现异常“找不到驱动程序"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                这是我的堆栈跟踪:

                  Exception 'yiidbException' with message 'could not find driver'
                
                in /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Connection.php:534
                
                #0 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Connection.php(836): yiidbConnection->open()
                        #1 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Connection.php(823): yiidbConnection->getMasterPdo()
                        #2 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Command.php(208): yiidbConnection->getSlavePdo()
                        #3 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Command.php(816): yiidbCommand->prepare(true)
                        #4 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Command.php(350): yiidbCommand->queryInternal('fetchAll', NULL)
                        #5 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/mysql/Schema.php(198): yiidbCommand->queryAll()
                        #6 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/mysql/Schema.php(97): yiidbmysqlSchema->findColumns(Object(yiidbTableSchema))
                        #7 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/db/Schema.php(140): yiidbmysqlSchema->loadTableSchema('migration')
                        #8 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/console/controllers/MigrateController.php(121): yiidbSchema->getTableSchema('{{%migration}}', true)
                        #9 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(610): yiiconsolecontrollersMigrateController->getMigrationHistory(NULL)
                        #10 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(102): yiiconsolecontrollersBaseMigrateController->getNewMigrations()
                        #11 [internal function]: yiiconsolecontrollersBaseMigrateController->actionUp(0)
                        #12 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
                        #13 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/base/Controller.php(151): yiiaseInlineAction->runWithParams(Array)
                        #14 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/console/Controller.php(91): yiiaseController->runAction('', Array)
                        #15 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/base/Module.php(455): yiiconsoleController->runAction('', Array)
                        #16 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/console/Application.php(161): yiiaseModule->runAction('migrate', Array)
                        #17 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/console/Application.php(137): yiiconsoleApplication->runAction('migrate', Array)
                        #18 /opt/lampp/htdocs/advanced/vendor/yiisoft/yii2/base/Application.php(375): yiiconsoleApplication->handleRequest(Object(yiiconsoleRequest))
                        #19 /opt/lampp/htdocs/advanced/yii(31): yiiaseApplication->run()
                        #20 {main}
                

                我是 yii2 的新手.我在 advaced/common/config/main-local.php 中添加了数据库名称、用户名.使用 xampp 网络服务器,php 版本为 5.6.8,并且还启用了 PDO.

                I am new to yii2. I have added database name,username in advaced/common/config/main-local.php. Using xampp webserver and version of php is 5.6.8 and PDO is also enabled.

                这是我的数据库配置.

                'db' => [
                        'class' => 'yiidbConnection',
                        'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
                        'username' => 'root',
                        'password' => '',
                        'charset' => 'utf8',
                    ],
                

                推荐答案

                在 Yii2

                最有可能是你的系统配置.如果你使用的是像这样的包MAMP、XAMPP 或其他,您可能需要将localhost"更改为db.php 配置文件中的127.0.0.1".另外如果你在Linux 你可能需要安装一些其他的附加包,比如php5-mysql 之类的东西."

                "Most likely it is your system config. If you are using packages like MAMP, XAMPP or other, you may need to change "localhost" to "127.0.0.1" in your db.php configuration file. Also if you are on Linux you may need to install some other additional packages like php5-mysql and stuff like that."

                这篇关于在 yii2 中迁移时出现异常“找不到驱动程序"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用 composer 在非空文件夹上安装包 下一篇:如何在 Yii2 Active Record 中将 JOIN 用于关系模型?

                相关文章

                <i id='e1bAD'><tr id='e1bAD'><dt id='e1bAD'><q id='e1bAD'><span id='e1bAD'><b id='e1bAD'><form id='e1bAD'><ins id='e1bAD'></ins><ul id='e1bAD'></ul><sub id='e1bAD'></sub></form><legend id='e1bAD'></legend><bdo id='e1bAD'><pre id='e1bAD'><center id='e1bAD'></center></pre></bdo></b><th id='e1bAD'></th></span></q></dt></tr></i><div id='e1bAD'><tfoot id='e1bAD'></tfoot><dl id='e1bAD'><fieldset id='e1bAD'></fieldset></dl></div>
                    <legend id='e1bAD'><style id='e1bAD'><dir id='e1bAD'><q id='e1bAD'></q></dir></style></legend>
                    • <bdo id='e1bAD'></bdo><ul id='e1bAD'></ul>

                    <tfoot id='e1bAD'></tfoot>

                    <small id='e1bAD'></small><noframes id='e1bAD'>