0

I use Laravel to connect MySQL database in my pet-project.

I use sail up -d after yarn dev to start the project. Working with DataGrip.

But I can't php artisan migrate because I have error SQLSTATE[HY000] [1049] Unknown database 'cookies-project'.

I tried to change localhost , 127.0.0.1. Use command: php artisan config:cache, php artisan optimize:clear but nothing work. Have the same error.

What I'm doing wrong? Can anyone help?

Volty
  • 1
  • Does this answer your question? [can't use migrate with sail laravel](https://stackoverflow.com/questions/65267604/cant-use-migrate-with-sail-laravel) – pr1nc3 Jul 28 '22 at 07:03
  • No. I tried to this answer. Now I have error SQLSTATE[HY000] [2002] No such file or directory. – Volty Jul 28 '22 at 07:11
  • Is it working when you change your db name to sail? – Vüsal Hüseynli Jul 28 '22 at 07:13
  • At what plan? I don't quite understand what you mean. I'm recently started learning programming – Volty Jul 28 '22 at 07:14
  • in your .env you can change your database credentials. Where you have already specified your database name as `cookies-project`. And I am asking you to change it to `sail` and try again to connect database. Did you even created a database in DataGrip with exact same database credentials in your .env? – Vüsal Hüseynli Jul 28 '22 at 07:28
  • Well, I try your advice. It's still not working. Error: SQLSTATE[HY000] [1049] Unknown database 'sail' (SQL: select * from information_schema.tables where table_schema = sail and table_name = migrations and table_type = 'BASE TABLE') Yeah, in DataGrip I create database with same credentials – Volty Jul 28 '22 at 07:31

1 Answers1

0

i had the same problem and for me I had to stop the mysql server installed on my computer it's worked

Not mamp or wamp server !

Try this

For Mac : brew services stop mysql

Windows : C:> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld"

C:> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqladmin" −u root shutdown

Linux: service mysql stop