Doctrine验证模式PDOexception [英] Doctrine validate-schema PDOexception

查看:106
本文介绍了Doctrine验证模式PDOexception的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在marco pivetta教程上做这一步时
验证-schema
我有这个错误:

When I do this step on marco pivetta tutorial Validate-schema I have this error :

[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES)

问题是,在线命令我想我的doctrine.local.php

The problem is, on line command i think my doctrine.local.php

return array(
'doctrine' => array(
        'connection' => array(
          'orm_default' => array(
                'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                  'host'     => 'localhost',
                  'port'     => '3306',
                  'user'     => 'root',
                  'password' => '',
                  'dbname'   => 'test',
                  'charset' => 'utf8',
                  'driverOptions' => array (1002 => 'SET NAMES utf8'),
                )
            )
        )
    )
);

。我的$ params是空的(Doctrine\DBAL\Driver\PDOMySql\Driver)和_constructPdoDsn返回标准$ dsn,而不是我的配置参数。

is not loaded for this tool. My $params is empty (Doctrine\DBAL\Driver\PDOMySql\Driver) And _constructPdoDsn return standard $dsn, not my configs params.

我的Os windows 7
我在wamp
上使用Zend Framework2,我使用Console2和gitBash命令行。

My Os is windows 7 I'm working with Zend Framework2 on wamp and I use Console2 with gitBash for command line.

我遇到任何帮助请 ?

I'm stuck any help please ?

推荐答案

我找到解决方案....

I found solution....

,我们必须使用这个行命令(或者我们也可以通过index.php从zf2 2.3.0开始在public dir中执行此命令)

On windows seven, we have to use this line command (or we can also do this command via index.php in public dir since zf2 2.3.0)

vendor/bin/doctrine-module orm:validate-schema

如果你使用gitBash不要忘记,如果你已经测试过你的APPLICATION_ENV变量在application.config.php像这个教程
Zf2 advance config setup
do in bash_profile file:

And, if you use gitBash don't forget if you have tested your APPLICATION_ENV variable in application.config.php like this tutorial Zf2 advances config setup do in bash_profile file :

export APPLICATION_ENV="development"

希望这有助于某人。
你不需要在根目录中有cli-config.php。

Hope this help someone. You don't need to have cli-config.php in the root directory to do that.

这篇关于Doctrine验证模式PDOexception的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆