用vagrant搭建了一个LNMP环境:
操作系统是centos 7.4
php是 7.1
MariaDB 是10.2.9
当执行laravel的命令php artisan migrate
时,mariadb发生错误:
[root@vagrant-prod production]# php artisan migrate
[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 1005 Can't create table `production`.`migrations` (errno: 168 "Unknown (generic) error from engine") (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)
[PDOException]
SQLSTATE[HY000]: General error: 1005 Can't create table `production`.`migrations` (errno: 168 "Unknown (generic) error from engine")
错误有时是这样的:
[root@vagrant-prod production]# php artisan migrate
[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table '`production`.`migrations`' already exists (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)
[PDOException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table '`production`.`migrations`' already exists
什么原因呢?
"Unknown (generic) error from engine" 未知内部引擎错误,maridb自身原因!