douao3063 2013-05-31 10:58
浏览 44

Laravel 4工匠迁移无法连接到远程mysql db [HY000] [1450]访问被拒绝用户'myuser'@'mypc'(使用密码:YES)

EDIT: I finally realised artisan is trying to connect to my machine instead of the remote database host specified in config. I assumed it would retrieve the hosts address along with the username and password. I'll try to specify the host's address on commandline and post back.

EDIT 2: I found the problem. Technical support for the host mislead me to my first edit. The problem was a mismatch in the password between a '1' and an 'l'. Sorry to have wasted your time.

I'm developing a Laravel 4 web app and I'm trying to execute migrations from sentry into a remote mysql database. I have been able to connect via phpmyadmin using the same credentials stored into laravel without any hassle, but artisan won't work.

Here's artisan command and output:

$ php artisan migrate --package=cartalyst/sentry

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

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [-- pretend] [--seed]

Laravel connection config:

'default' => 'mysql',
[...]
'mysql' => array(
        'driver'    => 'mysql',
        'host'      => 'hostname.example.com',
        'database'  => 'mydb',
        'username'  => 'myuser',
        'password'  => 'supersecretpassword',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
   ),

I don't have mysql installed locally, just apache, php and phpmyadmin. My box is archlinux and I don't have access to the remote host.

Any ideas?

  • 写回答

1条回答 默认 最新

  • dongpai9986 2013-05-31 11:35
    关注

    You need to grant rights to that user on that host (this is the machine from where you connect):

    GRANT ALL ON mydb.* TO myuser@mypc IDENTIFIED by 'supersecretpassword';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂