I created a text file called create.sql in my Documents folder
the file contains this
use test
CREATE TABLE mytesttable (
id int unsigned NOT NULL AUTO_INCREMENT,
test_date timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ;
From a windows command line prompt, you invoke mysql command line, directing it to read infrom a text file.
C:\Users\Barry>mysql -uroot -p < "D:/users/barry/documents/create.sql"
Enter password: ********
C:\Users\Barry>
Then open a mysql command line to check the results of your work
C:\Users\Barry>mysql -uroot -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 284
Server version: 8.0.27 MySQL Community Server - GPL
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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> use test
Database changed
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| mytesttable |
+----------------+
2 rows in set (0.02 sec)
mysql>
Good luck,
Barry.