MySQL terminal
We are going to create a new database, user and password and grant that user access to the new database. Let’s first login to MySQL in the terminal.
1 | $ mysql -uadmin -ppassword |
Hit return and that will log you in, provided your credentials are valid! Note that there is no gap after the -p password switch. That is intentional, because otherwise MySQL would read the space as part of the password.
You don’t need to remove the space after the -u username switch, but I always do. As a side note, removing the space after the database selector switch (-B) will cause MySQL to look for the wrong database and fail.
Let us see what databases already exist.
1 2 3 4 5 6 7 |
Ok, let us first create the new database.
List our databases again, and you will see the addition.
1 2 3 4 5 6 7 8 |
Now we will need a user for this database, I guess.
1 2 |
The IDENTIFIED BY part specifies the password this user will have. Next we need to grant permissions to this user on our new database.
1 2 | mysql> GRANT ALL PRIVILEGES ON awesome_sauces.* TO 'saucemaker'@'localhost'; Query OK, 0 rows affected (0.00 sec) |
That is all we need. Now we can flush the privileges and go home.
1 2 3 |
All done.
Now you can populate your config file and away you go.