Blanca
Blanca

Reputation: 957

Sql script, create a database

I have the next file: create_mysql.sql

DROP DATABASE IF EXISTS playence_media; CREATE DATABASE playence_media; USE playence_media;
GRANT ALL PRIVILEGES ON . TO 'media'@'localhost' IDENTIFIED BY 'media' WITH GRANT OPTION;

But I don't know how to create this database. I would like to do it with my terminal, no other graphics interfaces. Thanks

Upvotes: 1

Views: 13579

Answers (2)

user358390
user358390

Reputation: 637

# mysql < create_mysql.sql

Upvotes: 1

nuqqsa
nuqqsa

Reputation: 4521

Using MySQL's command line client:

mysql -h <host> -u <username> -p < create_mysql.sql

You can ommit the -h <host> part if the server runs on your localhost.

Upvotes: 5

Related Questions