Unknown database

Error: ER_BAD_DB_ERROR: Unknown database ‘tweetr’

I am new to adonis, on migration (adonis migration:run) error occurred that i mentioned above

1 Like

You need create database before command adonis migration:run

What’s yours? MySQL? PostgreSQL?

1 Like

In your project directory, you will find a hidden file called .env

There you can write the name of your database, as well as the required credentials to access it.

MySQL, Yes I have created the db but it’s still getting the same issue

Yes, I’ve already done that too

.env file:
HOST=127.0.0.1
PORT=3333
NODE_ENV=development
APP_NAME=AdonisJs
APP_URL=http://${HOST}:${PORT}
CACHE_VIEWS=false
APP_KEY=er8ist53I9JUGoKf7HFSuJAVBFgBRjdM
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASSWORD=
DB_DATABASE=tweetr
HASH_DRIVER=bcrypt

run this command mysql -uroot tweetr

Whats happens?

Thanks,
The problem is with my computer’s MySQL, after I restart my computer it works fine.

-Happy Coding

1 Like

Good.
I was wondering if you created the tweetr MySQL database.

1 Like