HomePHP Page 4 - Building an E-Commerce Site Part 1: Building a Product Catalog
Step 1: Creating the Database - PHP
This is the first article in a three-part series dealing with using PHP 4 and MySQL to make a comprehensive e-commerce storefront solution. This article covers the product catalog database design and creating the catalog administration interface.
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.
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: