469,081 Members | 1,814 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

setting database pw


i've searched quite a bit, but cant find any post relating to sql
command for setting database passwords. anyone know how? thanks


Nov 23 '05 #1
4 1788
You can only set passwords for user accounts, not for specific databases:

set password for user@host = password('your_password');

Find more detailed information here:

Nov 23 '05 #2
thanks for the reply markus.

i was under the same impression, but i set up a wiki on my server and i
noticed that the mysql_connect command the wiki uses doesn't
authenticate with my mysql server password.

when i initally set up the wiki, it asked me to create a pw for the
wiki DB. this pw was not my mysql user pw.

how is it still able to query the wiki db (without my mysql user pw)

i also wrote my own php script and provided the wiki DB pw to the
mysql_connect command. the connection surprisingly also worked.

// case A:
$link = mysql_connect('localhost', 'mysql_user', 'wikiDB_password');
mssql_select_db('[wikiDB]', $link); // success

// case B:
$link = mysql_connect('localhost', 'mysql_user', 'wikiDB_password');
mssql_select_db('[anotherDB]', $link); // fails as expected - didnt
create pw for this DB

i shutdown my wiki and restarted it before trying the above too. how is
this possible? case B makes me think you can set DB specific pw...?

thanks in advance,


Nov 24 '05 #3
On Thu, 24 Nov 2005 14:20:47 -0800, pk_pk wrote:
...case B makes me think you can set DB specific pw...?

Part of the user permissions is which databases can be accessed, and in
what capacity (read-only, update, drop, etc.)

Mike A.
MySQL 5.0.15 on FreeBSD 5.4

Nov 25 '05 #4
thanks markus and mike =) i looked more carefully into the link markus
pasted, and there is mention of "user permissions is which databases
can be accessed" with the "GRANTS" command.

Nov 28 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Fran Tirimo | last post: by
4 posts views Thread by Phil Campaigne | last post: by
1 post views Thread by Suresh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.