I always forget these steps, so I have to write them down now. Thanks to this article.
$ mysql -u root -p mysql> create database dbname; mysql> grant usage on *.* to user@localhost identified by 'password'; mysql> grant all privileges on dbname.* to user@localhost;