I am setting up mysql/nodejs app.
I would like to delete database, recreate it and create table on each server restart.
If I specify connection with database:
let con = mysql.createConnection({
host: "localhost",
user: "root",
password: "pass",
database: "my_db",
});
I can create table, indexes, insert values but just first time. Every subsequent time it will tell me that everything is already created.
If on the other hand I do not put database when I create connection, I can delete database, create new one, but when I try to create a table I get an error that I don't have a database associated with this table.
Any idea how to get around this?