问题原文
原帖链接 · TmCrafz · CC BY-SA 4.0
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?
已采纳解答
原帖链接 · Martin · CC BY-SA 4.0
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!)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
