| user_mysql_mgmt.pl -- MySQL user management script |
user_mysql_mgmt.pl - MySQL user management script
user_mysql_mgmt.pl user_mysql_mgmt.pl --config=
You have to invoke user_mysql_mgmt.pl always with --config=. The script will parse the configuration file and add/delete or modify the MySQL user tables in the mysql database.
The options which apply to the user_mysql_mgmt.pl command are:
Verbose: print information messages about all actions.
Help: print help and exit.
Config: Supply an configuration to the script.
Set-Password: Set an new hashed password in the configuration file. You have to supply with B<--user=> the username.
User: Supply an username for changing the password. Please see B<--set-password>.
MySQL-Old-Hashing: Use the old MySQL 3.x password hashing.
The script needs one MySQL user with global privileges: Reload,Grant,Create user. This user needs also SELECT,INSERT,UPDATE,DELETE privileges at database mysql.*.
You can use the following GRANT statement:
GRANT RELOAD , CREATE USER ON * . * TO 'myadmin'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION ;
GRANT SELECT,INSERT,UPDATE,DELETE ON `mysql` . * TO 'myadmin'@'localhost';
The username and password of your control user needs to be stored in your configuration file.
This command will update the hashed password for user foo@localhost in the configuration file. Please note, you have run after this update password command the normal run with:
./user_mysql_mgmt.pl --config=user_mysql_mgmt.conf
This will update the new password into MySQL tables.
# global settings
<global>
# username,password for the control user
mysql_host localhost
mysql_password your-password
mysql_user admin
</global>
<users>
<foo>
host localhost
# If password is not supplied, password will not be updated by the script!
password *6A7A490FB9DC8C33C2B025A91737077A7E9CC5E5
<db>
foo:select,update,insert
one_more_db:delete,drop,show_view
</db>
</foo>
<jonas>
# put active 0: user will be deleted on the next run!
active 1
<db>
</db>
global_privs select,drop
host %
password
</jonas>
</users>
No environment variables are used.
Copyright (c) 2009 Jonas Genannt
This script is free software; you can redistribute it and/or modify it under the terms of GPL.
Jonas Genannt <jonas@brachium-system.net>
| user_mysql_mgmt.pl -- MySQL user management script |