亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

解決在laravel中auth建立時(shí)候遇到的問題

 更新時(shí)間:2019年10月15日 15:33:17   作者:一人之下丶  
今天小編就為大家分享一篇解決在laravel中auth建立時(shí)候遇到的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

當(dāng)你使用auth做用戶登錄注冊(cè)的時(shí)候,會(huì)很方便,但是你在做數(shù)據(jù)庫遷移的時(shí)候可能會(huì)遇到一個(gè)問題

$ php artisan migrate
Migration table created successfully.



 [Illuminate\Database\QueryException]
 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
 oo long; max key length is 767 bytes (SQL: alter table `users` add unique `
 users_email_unique`(`email`))

 [PDOException]
 SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
 oo long; max key length is 767 bytes

不要慌,這里說的是你的數(shù)據(jù)庫遷移完成了,蛋疼的是這里有一個(gè)報(bào)錯(cuò),會(huì)使你在接下來項(xiàng)目中后面的遷移操作繼續(xù)報(bào)錯(cuò)。

 [Illuminate\Database\QueryException]
 SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
 ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
 ement primary key, `name` varchar(191) not null, `email` varchar(191) not n
 ull, `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)

 [PDOException]
 SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
 ady exists

解決方案如下:

索引長(zhǎng)度 & MySQL / MariaDB#

Laravel 默認(rèn)使用 utf8mb4 字符,包括支持在數(shù)據(jù)庫存儲(chǔ)「表情」。如果你正在運(yùn)行的 MySQL release 版本低于5.7.7 或 MariaDB release 版本低于10.2.2 ,為了MySQL為它們創(chuàng)建索引,你可能需要手動(dòng)配置遷移生成的默認(rèn)字符串長(zhǎng)度,你可以通過調(diào)用

項(xiàng)目/app/Providers/AppServiceProvider.php 中的 Schema::defaultStringLength 方法來配置它:

use Illuminate\Support\Facades\Schema;
 
/**
 * 引導(dǎo)任何應(yīng)用程序服務(wù)。
 *
 * @return void
 */
public function boot()
{
 Schema::defaultStringLength(191);
}

或者你可以為數(shù)據(jù)庫開啟 innodb_large_prefix 選項(xiàng),有關(guān)如何正確開啟此選項(xiàng)的說明請(qǐng)查閱數(shù)據(jù)庫文檔。

以上這篇解決在laravel中auth建立時(shí)候遇到的問題就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論