laravel - Laravel 5.7 迁移错误:SQLSTATE[HY000] [2002] No such file or directory
问题描述
我正在为 laravel 使用宅基地。我已经安装了 2 个虚拟网站。当我尝试迁移时,两个网站数据库运行良好。但是今天我创建了新网站并尝试迁移,我发现错误如下所示。
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = test and table_name = migrations)
这是我的 .env 文件
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:2ZFx67Hrfao+ngk6hmyjDPmmXPiz4hXejJ5ncMqeX5E=
APP_DEBUG=true
APP_URL=http://test.app
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=33060
DB_DATABASE=test
DB_USERNAME=homestead
DB_PASSWORD=secret
这是 homestead.yaml 文件
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
ssl: true
folders:
- map: ~/Dev/sites/test
to: /home/vagrant/sites/test
- map: ~/Dev/sites/cvms
to: /home/vagrant/sites/cvms
- map: ~/Dev/sites/poms
to: /home/vagrant/sites/poms
sites:
- map: test.app
to: /home/vagrant/sites/test/public
- map: cvms.app
to: /home/vagrant/sites/cvms/public
- map: poms.app
to: /home/vagrant/sites/poms/public
databases:
- test
- cvms
- poms
当然,除了 DB_DATEBASE 项之外,这在两个站点的配置之前是相同的。
我不明白为什么会出错。
对不起我糟糕的英语....
解决方案
尝试访问您的.env
文件。按照您的 phpadmin 的建议,检查所有数据库名称/信用凭证是否正确。
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
推荐阅读
- windows - Neo.ClientError.Procedure.ProcedureNotFound Neo4j Windows 桌面版
- javascript - 使用 jquery 用一个月的总天数填充表数据
- delphi - delphi:组合框搜索文本与项目文本大小写相同
- python - 如何编写一个接收整数的函数 function(n),并使用 while 循环返回前 n 个偶数的总和?
- laravel - 无法在 laravel 6.9.0 共享主机部署中创建符号链接
- django - 容器以分离模式运行时未执行初始化脚本
- c - 函数第一次调用时正确分配内存,但第二次没有
- spring-boot - 谁调用 configureGlobal 函数?如何调用configureGlobal函数?
- laravel - Laravel Controller 中查询内的条件计数
- android - 在 MediaStyle 通知中禁用或隐藏搜索栏