Building an E-Commerce Site Part 1: Building a Product Catalog - Step 1: Creating the Database
(Page 4 of 8 )
We will create a database called mymarket and then a user account called myuser with the password mypassword. Fire up MySQL and login as the root user by issuing this command from the shell prompt:
$ mysql -u root -p
You should see MySQL started:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 412 to server version: 3.22.30
Type 'help' for help.
mysql>
From here, issue the following commands:
mysql> CREATE DATABASE mymarket;
This creates a database called mymarket. Now let's create the
myuser account and specify the privileges that he has in the mymarket database. Issue this command:
mysql> GRANT select, insert, update, delete
-> ON mymarket.* TO myuser@localhost IDENTIFIED BY 'mypassword';
This will add an entry into the appropriate MySQL security tables that tell MySQL to create a user called myuser who uses the password mypassword. myuser can only connect from localhost, and once properly authenticated will be able to issue SELECT, INSERT, UPDATE and DELETE queries on all the tables in the mymarket database (mymarket.*).
Next we have to make mymarket the current database:
mysql> USE mymarket;
Next: Step 2: Creating the Product Catalog >>
More PHP Articles
More By Ying Zhang