John Davidson

laravel - Can't using php artisan migrate

0 comments
Message:


I create new project laravel and I want to migrate, so I do


php artisan serve

but why I got


SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

I do following this advise


Can't run migrations in Laravel 8: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known


to change the value in DB_HOST, but when I checked, it was completely just set like that advice


my .env


APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:TqD4fedTyWRixmGVCzmjFHSriROFu/57yZRZeM5YI6Q=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

I also do


php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear

I do change in file database.php
from


  'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',

to


  'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',

instead of done, it give me


  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(255) not null, `email` varchar(255) not null,
`email_verified_at` timestamp null, `password` varchar(255) not
null, `remember_token` varchar(100) null, `created_at` timestamp
null, `updated_at` timestamp null) default character set utf8
collate 'utf8_unicode_ci')

when I wrote again, it still got the same way


before this, I wrote migrate and still good, why it's get hard than before?


thank's



My Answer:
you please provide more context or clarify your question about Laravel?

Rate this post

3 of 5 based on 2361 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us