setting database pw

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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


Re: setting database pw

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:


Re: setting database pw

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,


Re: setting database pw

On Thu, 24 Nov 2005 14:20:47 -0800, pk_pk wrote:

Quoted text here. Click to load it

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

Re: setting database pw

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.


Site Timeline