Opened 3 years ago
Last modified 3 years ago
#866 new defect
MySQL munin plugin: connection problems for 5.0.89
| Reported by: | yonas | Owned by: | nobody |
|---|---|---|---|
| Priority: | normal | Milestone: | Munin 2.0.0 |
| Component: | plugins | Version: | 1.4.3 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I created a user "munin" with SUPER privileges. I get connection problems unless I grant a random privilage for "munin" on the "mysql" database (very strange....).
root# munin-run mysql_innodb_tnx
DBI connect('mysql;mysql_connect_timeout=5','munin',...) failed: Access denied for user 'munin'@'localhost' to database 'mysql' at /etc/munin/plugins/mysql_innodb_tnx line 876
[mysql*] env.mysqladmin /usr/bin/mysqladmin env.mysqluser munin env.mysqlpassword xxxxxxxxx
Once it works at least once, I change remove all the extra privilages I gave it for "mysql" database, and the plugin will continue to work. If I restart mysql server, the connection is dropped and I have to repeat this process.
Change History (4)
comment:1 Changed 3 years ago by knan
comment:2 Changed 3 years ago by yonas
Ahh, that could work. That's how I setup the older mysql_ plugin, which didn't have connect problems.
comment:3 Changed 3 years ago by yonas
Worked! :) I created a new database and gave the user "munin" all privilages to that db, as well as giving SUPER privileges.
This needs to be better documented, though. I'd suggest explaining that, when connecting with a non-root user,
a) a simple privilege, such as SELECT, on the "mysql" db will suffice.
env.mysqluser <your username here>
env.mysqlpassword <your password here>
or
b) create a new db, assign all privileges to that db only to your "munin" user, and change the connection string:
env.mysqlconnection DBI:mysql:<your databasename here>
env.mysqluser <your username here>
env.mysqlpassword <your password here>
comment:4 Changed 3 years ago by yonas
Worked! :) I created a new database and gave the user "munin" all privilages to that db, as well as giving SUPER privileges.
This needs to be better documented, though. I'd suggest explaining that, when connecting with a non-root user,
a) a simple privilege, such as SELECT, on the "mysql" db will suffice.
env.mysqluser <your username here>
env.mysqlpassword <your password here>
or
b) create a new db, assign all privileges to that db only to your "munin" user, and change the connection string:
env.mysqlconnection DBI:mysql:<your databasename here>
env.mysqluser <your username here>
env.mysqlpassword <your password here>

It will probably work if you add
env.mysqlconnection DBI:mysql:<yourdatabasename here>
... the default connection string connects to the "mysql" database. You need privileges to connect to a random database on the server (not necessarily "mysql"), due to how DBD::mysql works.
Try it and report back?