Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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 <query>| |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 ===== <code> Plugin MySQL { server 'www.myserver.foo' port 3306 user 'admin' password 'topsecret' database 'shop' } </code> 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 ===== <code> 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 } </code> ---- plugin_mysql.txt Last modified: 2020/07/17 18:33(external edit)