How do I run a script on/in a mysql database?

ddl, mysql, mysql-workbench

Solution

create database mydatabase;

grant all on mydatabase.* to 'myuser'@'%' identified by 'mypasswd';

create table mytable (
id int not null auto_increment,
myfield varchar(255) not null default ''
);

etc...

Put that in a file called mydbcreate.sql and run (from the command line)

mysql -u <myuser> -p < mydbcreate.sql

Problem

I have created a MySQL database using MySQL Workbench. It has about 20 tables. I cannot figure out how to run scripts on the database. Basically, I want to make a database creation script which will allow me to create my database on any other MySQL server.

Original source