Open eapo opened 6 years ago
Found a solution to this here. I just updated to the latest release of MarinaDB.
Index Lengths & MySQL / MariaDB Laravel uses the utf8mb4 character set by default, which includes support for storing "emojis" in the database. If you are running a version of MySQL older than the 5.7.7 release or MariaDB older than the 10.2.2 release, you may need to manually configure the default string length generated by migrations in order for MySQL to create indexes for them. You may configure this by calling the
Schema::defaultStringLength
method within yourAppServiceProvider:
use Illuminate\Support\Facades\Schema;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
Alternatively, you may enable the innodb_large_prefix option for your database. Refer to your database's documentation for instructions on how to properly enable this option.
The instructions are right there:
(SQL: a lter table users
add unique users_email_unique
(email
))
Rewrite the table.
On May 25, 2018 12:49 PM, "eapo" notifications@github.com wrote:
The Migration table created successfully, but n content because of Syntax error. The same with utf32, utf8, utf8mb4.
php artisan migrate
Migration table created successfully.
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: a lter table
users
add uniqueusers_email_unique
(at C:\xampp\htdocs\edu\vendor\laravel\framework\src\Illuminate\Database\Connec tion.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make th is exception a 662| // lot more helpful to the developer instead of just the databa se's errors. 663| catch (Exception $e) {
664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|
Exception trace:
1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Sp ecified key was too long; max key length is 767 bytes") C:\xampp\htdocs\edu\vendor\laravel\framework\src\Illuminate\Database\Conne ction.php:458
2 PDOStatement::execute() C:\xampp\htdocs\edu\vendor\laravel\framework\src\Illuminate\Database\Conne ction.php:458
XAMPP on Windows v3.2.2
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thedevdojo/chatter/issues/210, or mute the thread https://github.com/notifications/unsubscribe-auth/ATnZTi9FH5QZaAGZmEXUQPdQFwUHp28Jks5t2GAsgaJpZM4UOfjH .
The Migration table created successfully, but n content because of
Syntax error
. The same with utf32, utf8, utf8mb4.XAMPP on Windows v3.2.2