Postingan lainnya
error ketika mau migrate database
Helloo saya masih belajar freamwork laravel.
ketika saya mau migrate database saya kog di cmd muncul error seperti ini ya
C:\xampp\htdocs\auth_login>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: alter table `users` add unique `users_email_unique`(`email`))
at C:\xampp\htdocs\auth_login\vendor\laravel\framework\src\Illuminate\Database\Connection.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 this exception a
662: // lot more helpful to the developer instead of just the database's errors.
663: catch (Exception $e) {
664: throw new QueryException(
665: $query, $this->prepareBindings($bindings), $e
666: );
667: }
668:
669: return $result;
Exception trace:
1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes")
C:\xampp\htdocs\auth_login\vendor\laravel\framework\src\Illuminate\Database\Connection.php : 458
2 PDOStatement::execute()
C:\xampp\htdocs\auth_login\vendor\laravel\framework\src\Illuminate\Database\Connection.php : 458
Please use the argument -v to see more details.
Padahal .env uda aku setting dengan benar sesuai database yang aku bukin
ini contoh .env nya
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:dZ4xu30bhSvP2Cew2n+rAi76mHWohUUCrnRakC+MzqE=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=login
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
mohon pencerahannya :)
0
2 Jawaban: