Web Hosting Talk







View Full Version : kinda newbie question


Juan
05-31-2001, 09:46 AM
how do I create an admin specially for one mysql database. Not an admin for the whole server, but one who can only edit and view his own dtabase.

Chicken
05-31-2001, 01:21 PM
You need to create a 'user', see:
http://www.mysql.com/documentation/index.html

Cael
06-01-2001, 03:44 AM
username=AAA databasename=BBB passwrod=CCC

create database BBB;

use mysql;

INSERT INTO user SET User = 'AAA', Host ='localhost', Password = PASSWORD ('CCC');

INSERT INTO db set User = 'AAA',Db='BBB', Host='localhost', Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y', Delete_priv = 'Y', Create_priv = 'Y', Drop_priv = 'Y', Grant_priv ='Y', References_priv = 'Y', Index_priv = 'Y', Alter_priv = 'Y';


That's the codes I use to add MySQL database and user. I think it might helps you, so I posted it.

adad
06-01-2001, 07:57 AM
I do the following steps. Please tell me if I'm leaving some security hole this way.

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

GRANT USAGE ON *.* TO some-user-name@localhost IDENTIFIED BY 'some-password';

This builds a dummy account, with no priviledges.

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

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON some-user-name.* TO some-user-name@localhost IDENTIFIED BY 'some-password';

This allows the user to only use the database that he is assigned. It also blocks any access other than localhost.

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

SHOW GRANTS FOR some-user-name@localhost;

This shows the priviledges assigned to a certain user.