In our last episode we found out how to connect to a MySQL server. This time we learn how to lay out a database and start creating it. For this, and following episodes, we will be looking at creating a database to support an online bookshop.
Creating the database
Using the mysql command line client, you can connect to the server and then create the database. We need a name for the database, and in this case we'll call it 'bookshop'. We'll also create a user who is specifically allowed to add and update the database, but not alter its structure:
mysql> CREATE DATABASE `bookshop`;[Read more]
Query OK, 1 row affected (0.01 sec)
mysql> GRANT INSERT, SELECT, UPDATE, DELETE ON `bookshop`.* to 'bookuser'@'localhost' identified by 'bookpass';
Query OK, 0 rows affected (0.00 sec) …