Backing up and restoring all databases in MySQL on linux I plan to dump all databases on one computer and restore them on another using the following 2 commands:-

mysqldump -u username -p --all-databases &gt; dump.sql

mysql -u username -p &lt; dump.sql


My query is : will the second command overwrite an existing table with the same name as on the first computer ? Also, will the second command delete all tables which are NOT there on the first computer?

Can someone please clarify?
The exact syntax used varies depending on what version of MySQL you are using, but the basic version of mysqldump (without any other options) you are using will run:

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /;

DROP TABLE IF EXISTS `test1`;
CREATE TABLE `test1` (. . . 


You can check this if you are concerned, before running the second statement, simply look in the file dump.sql (it is just a text file) and you can see clearly what queries it will run. 

So to answer your questions:


  will the second command overwrite an existing table with the same name as on the first computer ?


Yes it will


  will the second command delete all tables which are NOT there on the first computer?


No it won't

You can get a full list of the options available from: https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#mysqldump-option-summary