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:
- 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.
- 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>
- mysql> grant all on zencartdb.* to 'zencart-user'@localhost identified by 'SOME PASSWORD HERE';
- Query OK, 0 rows affected (0.01 sec)
- mysql>
- 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)
- mysql>
You can now logout of MySQL and proceed with your Zen Cart ecommerce store installation.