我无法使用 mysql 的端口号 3306 访问数据库并在 laravel 项目中迁移
I can't access database and migrate in laravel project using port number 3306 for mysql
The first picture is the database config in .env file and the port number is 3306
The second picture is the database config in /config/database.php file
The third picture is the database config in mysql workbench
.env文件中端口号设置为3306时无法迁移模型和访问数据库,设置为33060则可以访问。
当我尝试 运行 "php artisan migrate".
时出现错误 "Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)"
尝试了很多方法,使用3306端口还是遇到同样的问题
Vagrant box 不会像您在 .env 文件中指定的那样在 localhost(127.0.0.1) 上 运行,您必须指定 ip_address
,您可以通过将 vagrantfile
config.vm.network "public_network", ip: "192.168.1.10"
之后 运行 vagran reload
在终端
The first picture is the database config in .env file and the port number is 3306
The second picture is the database config in /config/database.php file
The third picture is the database config in mysql workbench
.env文件中端口号设置为3306时无法迁移模型和访问数据库,设置为33060则可以访问。
当我尝试 运行 "php artisan migrate".
时出现错误 "Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)"尝试了很多方法,使用3306端口还是遇到同样的问题
Vagrant box 不会像您在 .env 文件中指定的那样在 localhost(127.0.0.1) 上 运行,您必须指定 ip_address
,您可以通过将 vagrantfile
config.vm.network "public_network", ip: "192.168.1.10"
之后 运行 vagran reload
在终端