>From the 5.0.x manual

How to create user accounts:

The next examples create three accounts and give them access 
to specific databases. Each of them has a username of custom 
and password of obscure. 


To create the accounts with GRANT, use the following 
statements: 

shell> mysql --user=root mysql
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
    ->     ON bankaccount.*
    ->     TO 'custom'@'localhost'
    ->     IDENTIFIED BY 'obscure';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
    ->     ON expenses.*
    ->     TO 'custom'@'whitehouse.gov'
    ->     IDENTIFIED BY 'obscure';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
    ->     ON customer.*
    ->     TO 'custom'@'server.domain'
    ->     IDENTIFIED BY 'obscure';


 The three accounts can be used as follows: 

The first account can access the bankaccount database, but 
only from the local host. 

The second account can access the expenses database, but 
only from the host whitehouse.gov. 

The third account can access the customer database, but only 
from the host server.domain. 

So you need 1 accout to access your database from localhost, 
and another account (with the same password to avoid 
confusion) to access your database from any other domain 
apart from localhost.

*****
You also need to read this Charles, then you will know how 
mysql checks who is authorised to connect to the server.

http://dev.mysql.com/doc/refman/4.1/en/connection-access.html
*****

HTH

Keith

In theory, theory and practice are the same;
in practice they are not.


On Tue, 21 Mar 2006, Charles Gambrell wrote:

> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> From: Charles Gambrell <[EMAIL PROTECTED]>
> Subject: Re: Cannot select the database
> 
> Thanks for the links.
> 
> The link on privilge had a link to a discussion of "access denied."
> http://dev.mysql.com/doc/refman/4.1/en/access-denied.html
> 
> Where I read -
> 
> "If you have access problems with a Perl, PHP, Python, or ODBC
> program, try to connect to the server with mysql -u user_name  db_name
> or mysql -u user_name  -pyour_pass  db_name. If you are able to
> connect using the mysql client, the problem lies with your program,
> not with the access privileges. (There is no space between -p  and the
> password; you can also use the --password=your_pass  syntax to specify
> the password. If you use the -p --passwordoption with no password
> value, MySQL prompts you for the password.)"
> 
> Well, that describes my situation and when I attempt at the command
> line of the host running MySQL to connect by "mysql -u mysql mydb"  I
> get the error message "error 1044 (42000) Access denied for user "@"
> localhost to database "mydb."
> 
> So I guess I do have an access problem the user "mysql" weather it is
> on the localhost or throught PHP.
> 
> Now to figure out how to give the right permission(s) to the user.  I
> know that the mysql user can connect to the "test" database from the
> command line or through a browser and PHP.  At least it looks like I
> am narrowing the problem down.
> 
> host | user      |  db
>  ------------------------------------
> %    |           | mynewdb
> %    | mysql | mynewdb
> %    |           | test
> %    |           | test\_%
> 
> 
> This looks like it means that from any host the mysql user can access
> the mynewdb database.  But it must not mean that.  What am I missing? 
> And I don't understand "test\_%" but I know I can connect to and open
> the test database.
> 
> Charles

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to