$ docker exec -it mysql8 bash root@9610b93b6185:/# 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@9610b93b6185:/tmp# mysql -e "CREATE DATABASE test" -proot mysql: [Warning] Using a password on the command line interface can be insecure. root@9610b93b6185:/tmp# mysql -proot test < dump.sql mysql: [Warning] Using a password on the command line interface can be insecure. root@9610b93b6185:/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 10 Server version: 8.0.15 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=utf8mb4 COLLATE=utf8mb4_0900_ai_ci 1 row in set (0.00 sec) +----+ | id | +----+ | 1 | | 11 | +----+ 2 rows in set (0.00 sec) Query OK, 1 row affected (0.01 sec) +----+ | id | +----+ | 1 | | 11 | +----+ 2 rows in set (0.00 sec) Query OK, 2 rows affected (0.07 sec) Query OK, 1 row affected (0.01 sec) mysql>