用laravel4.2写了个项目,在本地做测试的时候是没有问题的
然后现在把项目搬到阿里云上之后 使用
php artisan migrate
显示
SQLSTATE[28000] [1045] Access denied for user 'root'@'XXXXXXXX' (using password: YES)
用户名和密码是正确的 因为通过
mysql -uroot -p
可以登录
下面是我的代码
'mysql' => array(
'driver' => 'mysql',
'host' => 'XXX.XXX.XXX.XXX',
'database' => 'sing',
'username' => 'root',
'password' => 'XXXXX',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
所以想请问一下 出现这样的问题的话怎么解决
If you are accessing the database locally
for specific operations.Put
'host' => 'XXX.XXX.XXX.XXX',
Change to
'host' => 'localhost' or 'host' => '127.0.0.1'
If the database is called remotely.
Then you need to add remote calling permissions to the user. Please refer to Baidu
mysql -uroot -p
Add the -h parameter to this command (corresponding to the host configuration in laravel) to see if it can still be connected.