Create Zen Cart MySQL Database And MySQL User

I always forget specific MySQL syntax including creating a MySQL user and granting that user specific access only via localhost to a specific database. So when I install Zen Cart I always end up looking how to do this via the MySQL documentation. Below are simple instructions on how to create a MySQL database using mysqladmin, create a MySQL user, and grant permission to the created database to the created MySQL user.

Create MySQL Database & User For Zen Cart Install:

  1. Create MySQL Database: First use mysqladmin to create the MySQL database you will use for your new Zen Cart installation using the syntax below.
    [root@dev ~]# mysqladmin -u root -p create zencartdb
    Enter password: ******
    [root@dev ~]#

    I suggest using something other than the default of zencart. Once you enter the command you will be required to enter the MySQL root users password.

  2. Create MySQL User: Once the database is created you can login to MySQL using the syntax below and then generate a user also by using the syntax exampled below.
    [root@dev ~]# mysql -u root -p
    Enter password: *******
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 31
    Server version: 5.0.77 Source distribution
    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
    mysql> grant all on zencartdb.* to 'zencart-user'@localhost identified by 'SOME PASSWORD HERE';
    Query OK, 0 rows affected (0.01 sec)
  3. Flush MySQL Privileges: Now while you are still logged into the MySQL CLI flush the MySQL privileges for the permissions changes to the user created above to take.
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

You can now logout of MySQL and proceed with your Zen Cart ecommerce store installation.

Zen Cart Optimization, 2010: SEO Techniques and Performance Optimization (Paperback)

List Price: $12.49
New From: $3,524.35 USD In Stock
Used from: $483.78 USD In Stock

Zen Cart: E-commerce Application Development: A step-by-step developer's guide (Paperback)

List Price: $49.99 USD
New From: $31.45 USD In Stock
Used from: $1.84 USD In Stock