What does mysqldump <do? Error in site database, almost shat my pants

I had to delete some records from a table, so before doing this I took a backup of this table with the mysqldump command. After the deletion, I realized that an error occurred, so I thought to myself ... NO PROBLEMS ... I have a backup, so I will restore it. I thought you used DATABASE> FILE.SQL when exporting, so importing would mean DATABASE <File.sql

So, I executed the following command:

mysqldump -u USER -p DATABASE < FILE.SQL

And then I realized that I made a mistake because he started showing all the records on the screen. As if it is running in verbose mode. I sat there completely still and froze, thinking about what the hell was going on !!!! because it even displayed those tables that I had not exported before. I did not know whether to stop it or let it complete the process. I waited about 2, 3 minutes, and then pressed Ctrl + C to stop it, and prayed to God that everything was in order. Then I checked my database in phpMyAdmin and apparently everything is in order, all the tables are present, as well as the data.

So my question is ... WHAT TO DO WHEN I SAID THIS S <It was a live database, and I almost pulled off my pants, trusting me!

thank

+3
source share
3 answers

Mysqldump <, ,
, ( , )

+5

mysqldump mysql :

mysql -u USER -p DATABASE < FILE.SQL
+3

I don’t think he did something. mysqldumpis a recording tool and, as far as I know, never accepts command line input. You fed him garbage that you did not understand, there was no harm.

+2
source

Source: https://habr.com/ru/post/1792769/


All Articles