php artisan迁移的问题
我对php artisan迁移有问题。我使用作为根,响应如下:php artisan迁移的问题,php,mysql,laravel,Php,Mysql,Laravel,我对php artisan迁移有问题。我使用作为根,响应如下: Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = cms and table_name = migrations and table_type = 'BASE TABLE'
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = cms and table_name = migrations and table_type = 'BASE TABLE')
我必须做些什么来解决这个问题
编辑1
我检查我的.env文件并对其进行配置
当我使用:
php artisan config:clear
php artisan migrate:instal
这让我有了一个请求:
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
这是我的.env文件
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=cms
DB_USERNAME=root
DB_PASSWORD=gaMoJVnwXp
我认为这是我并没有进行表迁移的问题,但它也不起作用。我还尝试在php.ini中启用pdo文件,但也没有成功。当我让php artisan迁移时,我必须有一个空数据库或一个名为migrations的表
编辑2
好了,我快做完了。它认为我在sql配置方面有问题。我重新安装了mysql服务器,现在我可以使用mysql命令了。现在我遇到了php artisan migrate的问题-我没有任何回溯,但它看起来像是在持续加载。您有什么想法吗?请检查并正确配置您的.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db
DB_USERNAME=root
DB_PASSWORD=123456
如果仍然不起作用,试试这个
php artisan config:clear
php artisan migrate:install
您可以通过控制台连接到数据库吗?SQLSTATE[HY000][2002]没有这样的文件或目录(SQL:create table
migrations
(id
int unsigned not null auto_increment主键,migration
varchar(255)not null,batch
int not null)默认字符集utf8mb4 collate'utf8mb4 unicode\u ci')