Mikael Fridh wrote:

On Wednesday 12 November 2003 17.15, David T-G wrote:

% [client]
% password="mysql_root_password"



What if one user connects to the database as different users (as I do, in
fact; sometimes all-db-root, sometimes one-db-root, sometimes read-only
user)?  Let's back this out of "root" and go to "ordinary" or perhaps
"kinda-limited-root" (who might have all privileges but only over a
single database).  And I admit that I haven't read the docs [regarding
this] yet, but can one specify user A = pass A and user B = pass B and so
on?


set up different my.cnf files for your different scripted users.
Make sure that they have proper permissions
then call mysql from your scripts like this:
mysql --defaults-file=/home/blah/secret/stupid-user.my.cnf
mysql --defaults-file=/home/blah/secret/clever-user.my.cnf

more info from "mysql --help"

Right. Note that the --defaults-file= option does not just specify an alternate .my.cnf, it also prevents looking in the global configuration files /etc/my.cnf and mysql_data_dir/my.cnf (/usr/local/mysql/data/my.cnf, for example). So, if you have anything set in one of the global files which you need, you'll have to duplicate those settings in your local files.


Alternatively, you can use the --defaults-extra-file= option. This reads the named file in between the global files and .my.cnf. Last mention of a setting wins, so you would not put a password in .my.cnf in this case.

Wouldn't it be nice if these options were mentioned in the mysql man page? Or is it just me?


Mike




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



Reply via email to