【发布时间】:2019-08-21 18:17:53
【问题描述】:
我已经成功安装了 Laravel,它在 http://127.0.0.1:8000/ 中运行。当我运行 php artisan migrate 时,它给了我以下错误。
PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=plantshop", "root", "", []) /Projects/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
我可以使用http://192.168.64.2 端口访问我的php myadmin,但不能通过http://127.0.0.1:8000/ 访问我的php myadmin,如果我转到此链接,我有一个lamp/htdocs/abc 目录,但页面没有显示,它说
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
我尝试更改端口号并直接将 unix_socket 指向 php myadmin,但它没有工作。我的配置有什么问题?我用的是mac,谁能帮帮我?
我的 .env 文件
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=plantshop
DB_USERNAME=root
DB_PASSWORD=
数据库.php
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
【问题讨论】: