Archive for category MySQL
mk-parallel-restore Outputs BLOB Data
Posted by jervin in BSD/Mac OSX, Linux, MySQL, Perl on August 1, 2010
Recently I was playing around with the Maatkit tools specifically mk-parallel-dump and mk-parallel-restore for refreshing development database copies with production copies. A problem arises when BLOB data is being displayed on the console and transforming my shell prompt into gibberish and missing the results of the restore. Breaking the restore as soon as the BLOB starts output, it was revealed that I was getting the "Got a packet bigger then 'max_allowed_packet' bytes" error. After setting this variable to a reasonable value the restore went smoothly.
MySQL Default DATETIME Value – A Quick Rant
Posted by jervin in BSD/Mac OSX, Linux, MySQL, Windows on November 20, 2009
I was reviewing a year old code which I am adding a feature to. It so happened I came to a familiar issue about having two timestamp/datetime columns, one which should have the CURRENT_DATE / NOW() as default value and the other with an 'ON UPDATE CURENT_TIMESTAMP'. Examine the simple structure below:
CREATE TABLE `stories` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 255 ) NOT NULL ,
`text` TEXT NOT NULL ,
`creationdate` DATETIME NOT NULL ,
`lastupdate` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = MYISAM
When you want to store stories, you would also want to record when it was originally created as well track the last time it was updated. The problem here is that adding a `DEFAULT NOW()` clause will not work for the `CREATE TABLE` query above as it is not supported. So when your insert a new story you will have to explicitly add a `NOW()` function for the `creationdate` row so it will reflect the current date as creation date. This should've been a simple schema functionality, turns out after more than a year MySQL seems to ignore for some reason.
Go on have yourself a read here http://bugs.mysql.com/bug.php?id=27645
How about you, how many times have you have to work around this from your application code?
Do you favor a “LAMP (Linux, Apache, PHP, MySQL) Integrator”?
I have been reading on a number of project management articles lately and trends on open source projects. There seems to be a lot of fellow PHP developers who are as well Linux administrators for many server functions inluding HTTP servers like Apache and database administrators like for MySQL. Many of them are certified for one or more while many are jumping between careers that emphasizes one to the other thus gaining essential experiences for each.
Looking at job posts from all over the internet, you should've noticed at one time a PHP gig that requires MySQL administration skills and/or knows their way around Linux. PHP does not come by itself anymore, at least commonly, thus I've thought the term "LAMP Integrator". A quick Google search does not seem to turn much on how to define such, thus I have a simple one.
LAMP Integrator - is a PHP developer primarily using MySQL as data backend with strong Linux administration and Apache tuning skills.
It may sound primitive, I am writing as I am thinking so comments and revisions are welcome.
Gumblar .cn – Infiltrating Hosting Accounts
Posted by jervin in Apache, MySQL, PHP, Server Security on May 20, 2009
Hosting accounts being compromised has been a common incident, however a sudden surge of this variant is quite alarming. This trojan does not target any particular software or script and is commonly exploited from a users computer where he usually FTP files to hosting accounts. The trojan scans for FTP usernames and passwords and use them to inject PHP scripts to the FTP server.
So far I have seen two variations, one being a slave for XSS attack and another as proxy or zombie perhaps for a DoS attack.
What to do or how do you know if you are infected? There is no simple prevention measure I can offer aside from asking you to scan and thoroughly clean your computer first. Download all your files from the ftp server, you can do PHP files only, however there is a probability a JS based file may exist as well. After downloading, scan all your files and reupload. Not too neat but it's the only method that works for me.