diff --git a/README.md b/README.md index bcf609c..416e8b2 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,11 @@ You should then configure the MySQL plugin: Port 3306 (default: 3306) User "root" (default: root) Password "xxxx" (default: empty) + Socket "/var/lib/mysql/mysql.sock" (default: /var/lib/mysql/mysql.sock) HeartbeatTable "percona.heartbeat" (if using pt-heartbeat to track slave lag) Verbose false (default: false) - + ## Metrics @@ -323,4 +324,4 @@ For versions of MySQL with support for it and where enabled, `INFORMATION_SCHEMA response_time_count.14 ## License -MIT (http://www.opensource.org/licenses/mit-license.php) \ No newline at end of file +MIT (http://www.opensource.org/licenses/mit-license.php) diff --git a/mysql.py b/mysql.py index c5182a2..44ab476 100644 --- a/mysql.py +++ b/mysql.py @@ -34,6 +34,7 @@ 'Password': '', 'HeartbeatTable': '', 'Verbose': False, + 'Socket': '/var/lib/mysql/mysql.sock' } MYSQL_STATUS_VARS = { @@ -289,7 +290,8 @@ def get_mysql_conn(): host=MYSQL_CONFIG['Host'], port=MYSQL_CONFIG['Port'], user=MYSQL_CONFIG['User'], - passwd=MYSQL_CONFIG['Password'] + passwd=MYSQL_CONFIG['Password'], + unix_socket=MYSQL_CONFIG['Socket'] ) def mysql_query(conn, query):