Redeploing exist project with new database

System Information
  • Strapi Version: 4.20.6
  • Operating System: Ubuntu 20.04.6 LTS
  • Database: mysql Ver 8.0.36-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
  • Node Version: v18.17.1
  • NPM Version: 9.6.7
  • Yarn Version:

I have a strapi project that is fairly big.
I want to redeploy the project with a new clean database.
I have configured the database.js file the connection to mysql work fine.

I copy the Strapi project folder somewhere else, I created a new empty database, then I ran npm run install and npm run build, but the table in the new empty database are not created.
I can’t find the right procedure to re deploy a fresh database for my existing project.

The project is configured to run with pm2 and it’s running in dev mode.

Only one table was created it’s the strapi_migrations table, their must be a command I need to give it to actually deploy all the table for the project.
Anyone can help?

Is it suppose to actually create the database when you do “npm Install”?
The only way I can get this to work is if I copy an existing database and then delete everything in it.

I’m stock with this, not sure where to find the information I need.
There must be away to tell strapi to generate the database.

I tried this:
npx strapi db:migrate:latest
error: unknown command ‘db:migrate:latest’

The solutions is to do a database dump with only the database structure.
Using mysql: mysqldump StrapiDB -d -u root -p > structureOnly.sql
npm install
npm run build
Then start the instance of this project.
When you get to it through the browser Strapi creates the base data that it needs.

I didn’t not find this clearly laid out in the documentation but now I know what to do and if someone else has the same question this is where to find the answer I guess…