====== MySQL plugin ====== This plugin allows execute SQL queries into a [[http://www.mysql.com|MySQL]] server. MySQL is a multithreaded, multi-user, SQL (Structured Query Language) relational database server (RDBS). Currently, MySQL plugin only supports retrieving the server status, retrieving the first row/column of a query and the number of rows returned by a query. ---- ===== Functions ===== |MySQL::count(query)|return the number of rows returned by | |MySQL::query(query)|return a string containing the first value of the row.| |MySQL::status()|return a string containing the current server status: Uptime in seconds, number of running threads, questions, reloads, and open tables.| ---- ===== Configuration example ===== Plugin MySQL { server 'www.myserver.foo' port 3306 user 'admin' password 'topsecret' database 'shop' } If //server// entry is missing, //localhost// will be assumed.\\\ If //port// entry is missing, MySQL default's one will be used.\\\ If //user// entry is missing, **LCD4Linux** unix owner will be assumed.\\\ If //password// entry is missing, empty password will be used.\\\ //database// entry is required. ---- ===== Widget examples ===== Widget CustomersOnline { class 'Text' expression MySQL::count('SELECT DISTINCT ip_address FROM whos_online') width 2 align 'R' update 30000 } Widget NewOrders { class 'Text' expression MySQL::query('SELECT id FROM orders WHERE status = 1') width 14 align 'R' prefix 'New Orders:' update 30000 } Widget MySqlLastOnline { class 'Text' expression MySQL::query('SELECT ip_address FROM whos_online order by timestamp DESC limit 1') width 10 align 'R' update 3000 } ----