It”s not the most common task in the world, but you might want to view processes from a particular user and once in a while you might even need to kill processes from a single user, be it during an attack or because you simply got a bug in an application bombarding your db server with connections!
Here is a small stored procedure which does exactly that!
– shows all processes owned by username@hostnamecall process_list("kill","username","hostname");
– kills all processes owned by username@hostname
The code for this stored procedure can be found below. If you have any comments / suggestions feel free to comment below.[Read more...]
I think that he should enable the MySQL multi-statement feature and then perform his comparison by concatenating the test statement repeatedly before sending it to the server:
[Read more...]#include <my_global.h>
#define MY_SOCKET "/tmp/mysql.sock"
int main(int argc, char *argv)
int i, nLoop;
When using Oracle, the data dictionary provides us with tons of tables and views, allowing us to fetch information about pretty much anything within the database. We do have information like that in MySQL 5.0 (and up) in the
information_schema database, but it’s scattered through several different tables.
Sometimes a client asks us to change the datatype of a column, but forgets to mention the schema name, and sometimes even the table name. As you can imagine, having this kind of information is vital to locate the object and perform the requested action. This kind of behaviour must be related to Murphy’s Law.
In any case, I’d like to share with you a simple stored procedure that has helped us a lot in the past.
CREATE DATABASE IF NOT EXISTS dba; USE dba;[Read more...]
Using Perl, a stored procedure which counts to the same value is obviously not going to be as fast as bytecode languages with JIT compilers but it is a lot faster than MySQL's native SQL stored procedures. These perl stored procedures are able to perform dynamic SQL using the familiar DBD::mysql driver without any risk of self-deadlock.
Of course, you can also write stored procedures in Java for many databases but I haven't yet written the neccessary Type 2 JDBC driver to perform a in-thread connection back into the database server to be[Read more...]
In a nutshell: What’s New in MySQL 5.1.
Release notes: Changes in release 5.1.x (Production).
And yes, very early on (at about two minutes in), I talk about my take on Monty’s controversial post at Oops, we did it again.
To play the video directly, go to http://technocation.org/node/663/play. To download the 146 Mb video to your computer for offline playback, go to http://technocation.org/node/663/download. The slides can be downloaded as a[Read more...]
CREATE FUNCTION xml_current_time() RETURNS DATETIME NO SQL
EXTERNAL NAME "xmlrpc://time.userland.com/RPC2;currentTime.getCurrentTime";