Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Debian, /root/bin folder was deleted.

The biggest problem is that mysql is missing. When I type:

> mysql
-bash: mysql: command not found

I have all data in /var/lib/mysql. How do I install mysql back without harming my data?

Here is what I see, when I search for mysql:

enter image description here

Is it true that I don't have mysql executable, so that I can do

full/path/to/mysql -v
share|improve this question

closed as not a real question by Magellan, Ward, mdpc, Jenny D, Tom O'Connor May 29 '13 at 8:28

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Install mysql like any other package? What does deleting /root/bin have to do with anything? – Michael Hampton May 29 '13 at 2:19
up vote 4 down vote accepted

Did you delete /root/bin, or did you delete /bin?

If the former you shouldn't have lost anything (root should NEVER have "user binaries" in ~/bin - if you do you're doing it wrong and should stop).

If the latter (and that's really where MySQL is installed on your system), reinstall the MySQL package (as well as everything else you've undoubtedly destroyed int he process!) as Michael Hampton suggested.

This is a case where you should really be restoring the lost files from backups (and being WAY more careful with the rm command in the future!). You happen to have lucked out, since as long as the MySQL data directory is safe all you need to do is get the binaries for the appropriate version of MySQL, install them appropriately, and start the MySQL server with your existing data directory.

share|improve this answer
I am a little bit confused, because I cannot find mysql anywhere. I cannot find mysqladmin either. Say, the following command - find / -name mysqladmin - does not return anything. Is it possible that because of some stupid occasion mysql resided in /root/bin? – Ivan Zamylin May 29 '13 at 6:36
Anything is possible - if you have encountered such a system you should rebuild it to be sane (and migrate your data) – voretaq7 May 29 '13 at 15:40

I suspect that the database and most of your system is intact IF all you deleted was /root/bin. What I suspect is that you might have deleted perhaps more of the /root directory, like that containing the environment for the root user (i.e. .profile). Thus you have not properly set PATH and thus the command is not found.

share|improve this answer

First please take a backup (cp to any other location) of /var/lib/mysql before doing anything In debian you can install mysql and mysql-server with apt-get

   apt-get install mysql-server mysql-client

Once installation done start Mysql and all should be fine.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.