我已经阅读了所有相关帖子,但我无法解决我的问题:
环境:
-笔记本电脑Win8.1运行Uniserver用于本地开发 -MySql 在 3306 端口 -Laravel 4.1.27
在我运行的一个新的 laravel 项目上
php artisan migrate:install
我收到 PDOException 错误。
我的database.php配置文件如下:
'default' => 'mysql',
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => array(
'sqlite' => array(
'driver' => 'sqlite',
'database' => __DIR__.'/../database/production.sqlite',
'prefix' => '',
),
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'afz',
'username' => 'afz',
'password' => 'xxxxxxxx',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'prefix' => '',
),
),
数据库排序规则与配置中的相同。
PDO 似乎安装在 phpinfo 中。
无法弄清楚哪里出了问题......
数据库访问在 Controller 中工作,但是当我尝试使用迁移时出现错误...
另一个运行正常的应用程序也有同样的问题,所以我认为它与 php 设置有关,但是什么?
信息:
命令输出截图
链接:PHOTO
最佳答案
你遇到了著名的“找不到驱动程序”异常,检查你的 PHP.ini 如果 pdo_mysql 已启用
首先,只需插入 phpinfo();并检查 PDO 驱动程序部分是否启用了 mySQL。
关于php - 运行 migrate :install on Uniform WAMP server 时 Laravel 4.1 中带有 mysql 驱动程序的 PDOException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23325034/