Problem description: According to the installation steps of the official laravel-admin document, execute: php artisan admin:install An error was reported during installation.
In fact, the problem of creating special characters in the database is too long. Laravel 5.4 changed the default database character set. Now utf8mb4 includes support for storing emojis. If you are running MySQL v5.7.7 or higher, you don’t need to do anything.
When you try to run the migrations command on some MariaDB or some older versions of MySQL, you may encounter the following error:
D:\wwwroot\www.test.com>php artisan admin:install
Migration table created successfully.
In Connection.php line 664:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (S
QL: alter table `users` add unique `users_email_unique`(`email`))
In Connection.php line 458:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
The solution is to add default values in app\Providers\AppServiceProvider.php, and you need to delete the database migrations and users tables. Re-execute: php artisan admin:install
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Schema; //add fixed sql class AppServiceProvider extends ServiceProvider { /* * * Bootstrap any application services. * * @return void */ public function boot() { Schema::defaultStringLength(191); //add fixed sql } /* * * Register any application services. * * @return void */ public function register() { // } }
Read More:
- [Solved] Laravel admin Error: Symfony\Component\Debug\Exception\FatalThrowableError : Class ‘Doctrine\DBAL\Driver\PDOMySql\Driver’ not found
- [WordPress Error] Fatal error undefined function is_network_admin()
- [Solved] Artisan error: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
- Laravel5.5 Error: SQLSTATE[42000] Syntax error or access violation 1071 Specified key was too long; max k
- laravel The Process class relies on proc_open, which is not available on your PHP installation.
- composer Error: The requested PHP extension ext-bcmath * is missing from your system. Install or enable
- [Solved] PDOException::(“SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long;
- PHP solves the problem that composer exceeds the memory size Allowed memory size
- Error during session start; please check your PHP and/or webserver log file and configure your PHP
- PHP encryption 3DES error Call to undefined function: mcrypt_module_open() solution
- PHP curl error: SSL certificate problem: unable to get local issuer certificate settlement program
- [Solved] laravel proc_get_status() has been disabled for security reasons
- [Solved] Laravel Upload Files Verificate Error: The file failed to upload.
- PHP use __Sleep() and __wakeup() method serializes the object
- PHP error in Windows: class’ mysqli ‘not found
- PHP: How to parse MHT file into HTML
- php_network_getaddresses: getaddrinfo failed (How to Fix)
- PHP parse error: syntax error, unexpected ‘use’
- PHP Error Object of class mysqli could not be converted to string in
- [Solved] PHP installation Phalcon expansion error