Creating a MySQL User and Database
From Dev411: The Code Wiki
To get started with MySQL you will need to create a user and a database:
% mysql -h localhost -p -u root Enter password: *** mysql> grant all on mydb.* to username@localhost identified by 'password'; mysql> quit
If the user already exists, exclude the password component:
mysql> grant all on mydb.* to username@localhost;
Now log in as the user and create the database:
% mysql -h localhost -p -u username Enter password: password mysql> create database mydeb; Query OK, 1 row affected (0.01 sec) mysql> quit
