2016-11-15 55 views
0

的機器上IP 178.33.13.83,我有以下parameters.yml一個symfony的應用程序:Symfony的3:學說:架構:更新返回ConnexionException

parameters: 
database_host: 178.33.13.80 
database_port: null 
database_name: alterxtn 
database_user: alterxtn 
database_password: ******************** 

但後來當我嘗試doctrine:schema:update我收到但以下情況除外:

[Doctrine\DBAL\Exception\ConnectionException] 
An exception occured in driver: SQLSTATE[HY000] [1045] Access denied 
for user 'alterxtn'@'178.33.13.83' (using password: YES) 

我不知道爲什麼它試圖連接到安裝該應用程序上,而不是在DATABASE_HOST機器

[編輯1]:

這裏與堆棧跟蹤的異常,請注意特別是Driver->connect()功能要帶好PARAMS:

ConnectionException in AbstractMySQLDriver.php line 103: 
An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'alterxtn'@'178.33.13.83' (using password: YES) 


in AbstractMySQLDriver.php line 103 
at AbstractMySQLDriver->convertException('An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'alterxtn'@'178.33.13.83' (using password: YES)', object(PDOException)) in DBALException.php line 145 
at DBALException::driverException(object(Driver), object(PDOException)) in Driver.php line 47 
at Driver->connect(array('driver' => 'pdo_mysql', 'host' => '178.33.13.80', 'port' => null, 'dbname' => 'alterxtn', 'user' => 'alterxtn', 'password' => '**********************************', 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), 'alterxtn', '******', array()) in Connection.php line 360 

[編輯2]:

我有shell中的錯誤可能不是symfony問題

[email protected]:$ mysql -h 178.33.13.80 -u alterxtn 
ERROR 1045 (28000): Access denied for user 'alterxtn'@'178.33.13.83' (using password: YES) 
+0

你在使用Symfony的開發環境嗎?如果沒有,您需要在更改參數後清除應用程序的緩存.yml –

+0

我清除了緩存數千次.... –

回答

0

這是我的錯誤。

sql-user被設置爲服務器特權localhost 將其設置爲%解決了該問題。