Create mysql database from command line

Connect to mysql server as root:

mysql -u root -p

mysql> CREATE DATABASE database-name;
...query ok.. etc etc, now
make some priviliges

mysql> GRANT ALL ON database-name.* TO
new-user-name@'localhost' IDENTIFIED BY 'new-password';

now exit mysql
and test:

mysql -u new-user-name -p

mysql> connect
new-database-name;
mysql> SHOW TABLES; (etc, create select etc to be
really sure)
mysql> use another-database-name; <= this should throw up
a permissions error - this is good and should occur.

mysql> use
mysql; <=should also throw up a permissions error -good, we don't want the
usr to access the grant tables!!!

thats it!