$ docker exec -it mysql5 bash root@a1945fd3902e:/# cd /tmp/; ls -alh total 14K drwxrwxrwt 2 root root 3 Feb 19 22:50 . drwxr-xr-x 22 root root 24 Feb 19 22:50 .. -rw-rw-r-- 1 1000 1000 524 Feb 19 22:46 dump.sql root@a1945fd3902e:/tmp# mysql -e "CREATE DATABASE test" -proot mysql: [Warning] Using a password on the command line interface can be insecure. root@a1945fd3902e:/tmp# mysql -proot test < dump.sql mysql: [Warning] Using a password on the command line interface can be insecure. root@a1945fd3902e:/tmp# mysql -proot test mysql: [Warning] Using a password on the command line interface can be insecure. Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.25 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW CREATE TABLE a \G SELECT * FROM a; DELETE FROM b WHERE id = 11; SELECT * FROM a; DROP DATABASE test; CREATE DATABASE test; *************************** 1. row *************************** Table: a Create Table: CREATE TABLE `a` ( `id` int(10) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk` FOREIGN KEY (`id`) REFERENCES `b` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) +----+ | id | +----+ | 1 | | 11 | +----+ 2 rows in set (0.00 sec) Query OK, 1 row affected (0.00 sec) +----+ | id | +----+ | 1 | +----+ 1 row in set (0.00 sec) Query OK, 2 rows affected (0.04 sec) Query OK, 1 row affected (0.00 sec) mysql>