Re: phpMyAdmin

by "Darrell King" <darrell(at)webctr.com>

 Date:  Sun, 7 Jul 2002 10:08:07 -0400
 To:  "Michael Gerholdt" <Michael.Gerholdt(at)fredonia.edu>,
"hwg-techniques" <hwg-techniques(at)hwg.org>
 References:  pmg
  todo: View Thread, Original
Yes, create a user for your scripts to use. Most hosting providers create
that user for you and provide you with the username and password, or provide
you with Web-based interface from which to create users. If you are doing it
yourself, though, then you will want to define which priveliges the web
application needs to do it's job and assign only those priveleges.

These next are from memory and not specifically tested as written...I'd
suggest allowing for errors in both the syntax and my memory!

Fir instanct, if you only want to get stuff from the database, you can grant
just select:

GRANT SELECT on databasename.*
TO username@localhost
IDENTIFIED BY 'password';

To allow for pulling records and changing them:

GRANT SELECT,UPDATE on databasename.*
TO username@localhost
IDENTIFIED BY 'password';

Add in making new records:

GRANT SELECT,UPDATE,INSERT on databasename.*
TO username@localhost
IDENTIFIED BY 'password';

Same as above, but only for one table:

GRANT SELECT,UPDATE,INSERT on databasename.tablename
TO username@localhost
IDENTIFIED BY 'password';

Give them everything on all tables in one databse:

GRANT ALL on databasename.*
TO username@localhost
IDENTIFIED BY 'password';

How about just inserting on a single column (named 'count')  in a single
table, as with a hitcounter?

GRANT INSERT (count)
on databasename.tablename
TO username@localhost
IDENTIFIED BY 'password';

Same as above, but let them insert today's date (column name 'today'), too:

GRANT INSERT (count,today)
on databasename.tablename
TO username@localhost
IDENTIFIED BY 'password';

Any one of these will create the user as well.  A great book to get is
"MySQL" by Paul DyBois.  Amazon carries it.

The default user for a MySQL installaiton is root (MySQL Root, not system
root), and is probably not someone you want to use for a Web
applicaiton...:).

D

----- Original Message -----
From: Michael

When developing apps for the web using mySQL, what is the normal default
user? Do we have to create a user and grant select on all the tables to that
user?

And if anyone is familiar with CPanel 4.8 which provides another way to
create db users ... what privs are these users created with?

I find user management on mySQL either at home from the DOS commandline (I'm
on a win98 machine) or any other interface perhaps the most challenging
aspect of mySQL.

Thanks,
Mike

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA