baikho
baikho

Reputation: 5368

DDEV ERROR 1049 (42000): Unknown database 'db'

I accidentally deleted my default db database without re-creating it, but had exit the container and now I can't ddev ssh into the project or even connect to mysql.

Project is not currently running. Try 'ddev start'.

Even though the containers are already up and running.

So did docker exec -it ddev-project-db bash, but then upon mysql -u root -p it keeps prompting with:

ERROR 1049 (42000): Unknown database 'db'

How can I create the db again?

When I try to re-create the whole project, the web container persistently fails with:

Container ddev-project-web Started Failed waiting for web/db containers to become ready: db container failed: log=, err=health check timed out after 2m0s: labels map[com.ddev.site-name:project com.docker.compose.service:db] timed out without becoming healthy, status= Container ddev-router Started

Upvotes: 2

Views: 775

Answers (1)

rfay
rfay

Reputation: 12975

You can easily fix this with ddev delete --omit-snapshot -y && ddev start

which will destroy your broken database environment, create a new one, and start up the project. Then you can import your database again with ddev import-db or restore a snapshot with ddev snapshot restore

Upvotes: 5

Related Questions