craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

Can't remove database: "rpc error" #286

Closed jskrivanek closed 2 years ago

jskrivanek commented 3 years ago

Description

Would like to remove a database via $ nitro db remove.

Error message after executing the command above: … removing Database Error: rpc error: code = Internal desc = error removing database: unable to start the command: fork/exec /usr/bin/mysql: invalid argument

Steps to reproduce

  1. $ nitro start
  2. $ nitro db remove

Additional info

jasonmccallister commented 3 years ago

@jskrivanek did you happen to create your environment on an earlier version of Nitro?

The command is saying the mysql tool is not installed, you might be able to run nitro update to pull the latest Docker images from Docker Hub and Nitro will recreate the containers for you. That should resolve it but let us know if it does not!

jskrivanek commented 3 years ago

@jasonmccallister Correct, did nitro update now and restarted (though nitro update is automatically executed after nitro self-update). Now I get an extended error:


❯ nitro db remove
… removing ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Error: rpc error: code = Internal desc = error removing database: Exit Status: 1
Commands: --user=nitro --host=mysql-8.0.23-3306.database.nitro -pnitro -e DROP DATABASE IF EXISTS ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2);

❯ nitro db backup
Getting ready to backup…
There is only one database to backup…
Preparing backup…
  … creating backup Database-2021-03-10-152552.sql ✗
Error: unable to backup the database, Error response from daemon: lstat /var/lib/docker/overlay2/63795f4e15e2c459ac51e9c957a0971b6fbcfd8a6df886ca9e13f424d9b52053/merged/tmp/Database-2021-03-10-152552.sql: invalid argument```
jasonmccallister commented 3 years ago

Ok, can you manually remove the database container using Docker Desktop (this will not remove your data, just the running container).

CleanShot 2021-03-08 at 13 35 15

The run nitro apply and it should recreate the container for the database and try the nitro db remove again?

ademers commented 3 years ago

On 2.0.6, and was getting removing example_craft3 Error: rpc error: code = Internal desc = error removing database: Exit Status: 1 I did what you suggested above and was able to then run command without error.

Update: noticing now that this only happens when I attempt to remove a DB from a second container, in this mySQL 8 and not my mySQL 5.7 container, which was the first one I created.

pbmills commented 2 years ago

Hello, I want to remove this unnecessary database rDatabase from my MYSQL container. I am not sure why it is created and what is the purpose of it. I have never created database called rDatabase

Screen Shot 2022-03-29 at 9 46 17 PM

When I try to remove this via nitro db remove, I keep getting this error … removing rDatabase Error: rpc error: code = Internal desc = error removing database: unable to start the command: fork/exec /usr/bin/mysql: invalid argument

jasonmccallister commented 2 years ago

Hi, we are closing this issue as we have decided to retire Nitro, so no additional work will occur on this project. You can read the official blog post here https://craftcms.com/blog/retiring-craft-nitro. We appreciate everyones feedback and involvement and we look forward to refocusing our efforts on Cloud!

If you're looking for a new local development environment, we recommend DDEV and have a knowledge base article to help you with the transition: https://craftcms.com/knowledge-base/migrating-from-craft-nitro-to-ddev.