I wanted to backup my MySQL database and I accidentally used mysql
command instead of mysqldump
. So I executed:
/usr/local/mysql5/bin/mysql -u db_username -p db_name > db_backup.sql
Instead of:
/usr/local/mysql5/bin/mysqldump -u db_username -p db_name > db_backup.sql
I was ask for the db password and nothing happened after. The process just didn't react and I had to kill it. Could this have damaged my database?
The mysql command is an interactive shell, in which you can execute SQL-Queries (like
SELECT * FROM accounts;
). Without shell redirection, it will print out a prompt (after entering the password), which indicates that you can enter a command now. This command is being read from stdin; without a quit command (or<Ctrl>
+<D>
to indicate EOF) this command obviously waits for input.Without any input, the database is unaltered, and therefore no harm is being done to the database (you only killed a client to access the database, not the database server process!)