作者:陈业贵 华为云享专家 51cto(专家博主 明日之星 TOP红人) 阿里云专家博主 文章目录 报错信息:解决方案:效果:(已经解决) 报错信息: Migrating: 201
Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException
sqlSTATE[42S01]: Base table or view already exists: 1050 Table ‘users’ already exists (SQL: create table users
(id
bigint unsigned not null auto_increment primary key, name
varchar(191) not null, email
varchar(191) not null, email_verified_at
timestamp null, passWord
varchar(191) not null, remember_token
varchar(100) null, created_at
timestamp null, updated_at
timestamp null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)
at D:\PHPstudy_pro\WWW\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we’ll fORMat the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database’s errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, this−>prepareBindings( this->prepareBindings( this−>prepareBindings(bindings), $e
714▕ );
715▕ }
716▕ }
1 D:\phpstudy_pro\WWW\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:501
PDOException:😦“SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘users’ already exists”)
2 D:\phpstudy_pro\WWW\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:501
PDOStatement::execute()
use Illuminate\Support\Facades\Schema; Schema::defaultStringLength(191);这句加在boot函数里面 把boot函数放到最上面
<?phpnamespace App\Providers;use Illuminate\Support\ServiceProvider;use Illuminate\Support\Facades\Schema;class AppServiceProvider extends ServiceProvider{ public function boot() { Schema::defaultStringLength(191); // } public function reGISter() { // }}
来源地址:https://blog.csdn.net/qq_37805832/article/details/128207703
--结束END--
本文标题: laravel8.x 报错信息: Illuminate\Database\QueryException SQLSTATE[42S01]: Base table or view already
本文链接: https://lsjlt.com/news/395685.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0