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

Re: [cobalt-users] mysql priviledges?



Hi All,

> How can I restrict a user to only a certain database?

Hmm, you ask how to "restrict" a user, and not how let to an user access
something. This means, that you must already be setting user privileges in
some way? (you should not use the columns in the user table of mysql to give
privileges, as that will give the user global access)

Anyways, the normal procedure for creating users and databases is the
following:

Telnet in.

mysql -uroot -p<password>

Where <password> should be substituted by your MySQL password.

create database newdb;

Where "newdb" will be the name of the new database.

grant all privileges on newdb.* to newuser@localhost identified by
'password';

Where newuser is the name of the new user, and password is his password.
Remember the quotes around the password.

This will give the user full access to his own database, and nothing else.

If you also want the user to be able to connect to the database from remote,
then use a line like this:

grant all privileges on newdb.* to newuser@"%" identified by 'password';

This procedure may look tedious, and that's why we have created a small
PHP-script for doing this in an easy way. It is available for free from our
website at http://www.raqsupport.net/

--
Jens Kristian Søgaard, Mermaid Consulting I/S,
jens@xxxxxxxxxxxxxxxxxxxx, www.mermaidconsulting.com,
Want your next server installation done by a professional?
http://server.mermaidconsulting.com/raqserverupdates.html