当我在终端输入“php artisan migrate”时,我会看到以下错误:
In Connection.php line 664:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations)
In Connector.php line 67:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
我正在使用mac和Mamp Pro,
**其他一些信息:** php artisan serve => Laravel开发服务器已启动:http://127.0.0.1:8000
.env file =>
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=1234
在phpMyAdmin中,所有内容的顶部都是writed => 服务器:localhost:8889
mamp pro ran时的本地主机地址=> http://localhost:8888/phpMyAdmin/
在phpMyAdmin => DB名称:laravel 用户名:root 通过:1234
答案 0 :(得分:0)
当您的凭据无法连接到已定义的sql主机时,会发生这种情况。
想法:
答案 1 :(得分:0)
尝试更改
DB_HOST=127.0.0.1
至
DB_HOST=localhost