[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: MySQL question



Aaron Traas wrote on Tue Jul 24, 2001 at 10:40:26AM:
> I currently have a database-driven web site up, with a PHP front end and
> MySQL back-end. The problem I'm having is that the login for the
> database is root and my root password. How do I change this?

As you have full controll over the database: GRANT the needed privileges
to some user. For example (on the mysql-CLI):

GRANT
  SELECT,INSERT,UPDATE,DELETE
ON
  yourdb.*
TO
  username@localhost
IDENTIFIED BY
  "password";

flush privileges;

> Also, I plan on having multiple web sites and thus multiple databases.
> Can I tie a user and password to one specific database (or set of
> databases) rather than giving said user access to all databases?

Of course you can. Simply grant different privileges to different users.
See thy mysql-Manual for the complete reference on the GRANT statement.

Matth¡as
-- 
Matthias Richter --+- stud. soz. & inf. -+-- http://www.uni-leipzig.de
-->    GPG Public Key: http://www.matthias-richter.de/gpg.ascii    <--

· Projekt Deutscher Wortschatz: <URL:http://wortschatz.uni-leipzig.de>

Attachment: pgpfuKQOq67pf.pgp
Description: PGP signature


Reply to: