If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / Don't use "root" for installs on XAMPP, or anywhere

Don't use "root" for installs on XAMPP, or anywhere

Started by davewest on 5 Oct 2014, 6:33 PM · Views: 1,310

Results 1 to 3 of 3
5 Oct 2014, 6:33 PM
#1
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Don't use "root" for installs on XAMPP, or anywhere

This may or may not help, but something that happen to me and I see some others with similar issues.

I had to do a wipe and upgrade of my PC due to jumping versions of Linux... normal event, so did my backups of all my testing and active ZC installs. As I was rebuilding my OS, I also downloaded a new xampp install and set it up. 'xampp-linux-x64-1.8.3-4-installer.run'

came with:
Apache 2.4.9 (Unix)
OpenSSL 1.9.1g
PHP 5.5.11 (Zend: 2.5.0)
MySQL 5.6.16

Server OS: Linux 3.13.0-36-generic

Everything went as expected and seamed to be working, until I accessed one of my test sites...

Problem:
Front of the store was a mess, no template, products so on.. tried to access admin, could not log in, didn't recognize the user or password. Came back to the forum and found hacks to fix admin login, did that, no luck. Tried a new install using ZC 1.5.3, it crashed and would not finish installing... again, tried some of the fixes and even thought that the installer sql syntax was off... I finely, got a message that said no 'connection to database' that's what I need to fix.

Solution:
There is no problems with ZC, may need to change some of the install instructions someday, but it's still the best cart program I've came across. The problem is with MySQL 5.6.16 and I'm not sure how far back this goes... ROOT user is not allowed access outside of phpmyadmin or root shell account. So if you created the database and left root as the only user, give root to the config files, you are not getting into that database until you resolve the user access issues, which means you can't use ROOT as the store database user anymore. It's about time this process became easer to do and it keeps host from restricting you from creating users...

So, before you install/upgrade you need to access phpmyadmin for your account.

  1. create a new database user with a strong password.
  2. Create the database that you will use for your site.
  3. From the new database, add the user and assign privileges... do not use 'GRANT'.

If you don't use 'create, alter, or drop' you wont be able to install/remove mods from the ZC admin.

this should be normal..

Attachment 14573

Now you can continual with the install/upgrade as you would of before... be sure to add this user in your config files and not root. The user and database in the image no longer exist..

:smile: so, lesson learned... always create a database user!! Passing it along

Dave
Always forward thinking... Lost my mind!

6 Oct 2014, 12:14 AM
#2
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: Don't use "root" for installs on XAMPP, or anywhere

davewest:

came with:
Apache 2.4.9 (Unix)
OpenSSL 1.9.1g
PHP 5.5.11 (Zend: 2.5.0)
MySQL 5.6.16

Server OS: Linux 3.13.0-36-generic

......

Now you can continual with the install/upgrade as you would of before... be sure to add this user in your config files and not root. The user and database in the image no longer exist..

:smile: so, lesson learned... always create a database user!! Passing it along

There is no such problem with MySQL 5.5.x (ie on my local dev environment).

Is your server OS Debian (Ubuntu, Mint) based or a derivative of the Red Hat family (CentOS...) ? This could make a difference when accessing MySQL as Root.

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

6 Oct 2014, 9:14 AM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Don't use "root" for installs on XAMPP, or anywhere

davewest:

Now you can continual with the install/upgrade as you would of before... be sure to add this user in your config files and not root.

Just to clarify. If the site is hosted on a shared server you won't have access to the root account anyway.

If you have a VPS the root account should only be used for administrative purposes an NOT used for the ZenCart database (or any other public facing database). This is a huge security risk.

davewest:

:smile: so, lesson learned... always create a database user!! Passing it along

From http://www.zen-cart.com/content.php?147-how-do-i-install-zen-cart

Database Setup

On the next screen, you are asked for Database Information about your MySQL database, username and password. These can be obtained from your cPanel or equivalent control screen provided by your host. If you do not have a clean MySQL database setup with a username and password, you will need to create one.
Contact your Hosting site if you need assistance in creating a MySQL database table and/or username and password. Note that you need to have your database and userID created before the Zen Cart® installer can continue past this screen.

----------------------------------------------------------

Although your advice is perfectly valid it doesn't apply to the majority of ZenCart users ... The exception being for those with a VPS and those installing on their own computer (local install).

As stated, the root account should never be used for public facing databases anyway, and with most local installs the root restriction that you have observed doesn't exist (See comments by Frank18), such a restriction would be applied as the default settings for whatever distro you are using (Centos being one example that I can think of).

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.