tags:

views:

38

answers:

2

Hi!
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

+1  A: 

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.

nuqqsa
Error message:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Blanca
Blanca: you need to supply your password if you set one...
Konerak
Yes, I write down my password, using -p in the comand line
Blanca
Well, it appears to be false - the login didn't work.
Konerak
ERROR 1045 (28000): Access denied for user 'slosada'@'localhost' (using password: YES)Althoug using password i have the same error
Blanca
-p alone will prompt for the password, use -p<password> (no whitespace in between) to provide it in-line.
nuqqsa
Thanks guys, everithing solved :)
Blanca
A: 

# mysql < create_mysql.sql

The same error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Blanca
This is not "the same error" as you didn't specify one in the original post, but you obviously need to supply valid login parameters if necessary.Read the mysql command manual.