如何使用MAMP将Laravel应用连接到MySQL? [英] How to connect a Laravel app to MySQL using MAMP?
问题描述
我在 http://laravel.com/docs/quick 上遵循Laravel快速入门指南.
I am following the Laravel quick start guide at http://laravel.com/docs/quick
我已完成所有设置,并正在使用MAMP.当我尝试查看/public/users
页面时,被打中:
I have everything set up and am using MAMP. When I try and view the /public/users
page, I am hit with:
PDOException
PDOException
SQLSTATE [28000] [1045]用户'root'@'localhost'的访问被拒绝(使用密码:是)".
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)" error.
我的database.php
文件如下所示:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'todolist',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
我的MAMP显示:
host localhost
port 8889
user root
password root
我的问题是,MAMP上的MySQL是否与我在本地创建的MySQL表分开?我假设是的,因为我看不到PHPMyAdmin上的表.如果是这样,是否可以将我的Laravel应用程序连接到MAMP的MySQL?
My question is, is the MySQL on MAMP's separate from the MySQL tables I have created locally? I am assuming yes because I am not able to see the tables on PHPMyAdmin. If so, is there a way to connect my Laravel app to MAMP's MySQL?
推荐答案
MAMPs MySQL在端口8889上运行,因此将'port' => '8889'
添加到您的配置数组中
MAMPs MySQL is running on port 8889, so add 'port' => '8889'
to your config array
这篇关于如何使用MAMP将Laravel应用连接到MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!