Posted on July 9, 2010, 1:08 pm, by Rhys, under
DBA,
MySQL.
If you encounter the following error when trying to create a partitioned table in MySQL Error Code : 1492 For RANGE partitions each partition must be defined Assuming you have defined your partitions then you probably have a syntax error. Take the following incorrect example. ?View Code MYSQLCREATE TABLE People ( PersonId INTEGER NOT NULL [...]
Posted on June 23, 2010, 10:12 pm, by Rhys, under
DBA,
MySQL.
Just a very quick post today! If you encounter this error when attempting to drop a MySQL database; Error dropping database (can’t rmdir ‘./database’, errno: 39) Then you probably have some rogue files in the folder where the database files are located. If you cd into this directory you will be able to view these [...]
Posted on June 12, 2010, 5:45 pm, by Rhys, under
MySQL,
T-SQL.
Not the sexiest blog title in the world but I thought I’d knock up a little post on the behaviour of MySQL and SQL Server with integer subtraction. How would you expect a database system to behave with positive and negative data types? Microsoft SQL Server doesn’t really have unsigned data types. All integer types [...]
Posted on June 3, 2010, 12:15 pm, by Rhys, under
DBA,
MySQL.
I usually use SQLYog to write any stored procedures for MySQL. Whenever you alter a procedure the editor essentially generates SQL to drop and then recreate it. ?View Code MYSQLDELIMITER $$ USE `db`$$ DROP PROCEDURE IF EXISTS `my_proc`$$ CREATE DEFINER=`root`@`%` PROCEDURE `my proc`() MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT ‘Just an [...]
Posted on May 21, 2010, 12:38 pm, by Rhys, under
DBA,
MySQL.
I’ve been building utilities with PHP and MySQL command-line tools to clone databases. I ran into an issue when exporting data from multi-gigabyte tables using the mysql client program. mysql: Out of memory (Needed 4179968 bytes) ERROR 2008 (HY000) at line 1: MySQL client ran out of memory The fix for this is easy; just use [...]
Posted on April 25, 2010, 3:22 pm, by Rhys, under
DBA,
MySQL.
I’ve recently needed to script out the create sql for various MySQL database objects. No Powershell or SMO to help with this so I’ve quickly rolled a PHP script to get this done. This will script out all tables, views, triggers, stored procedures and functions from the specified database. One file per object in your [...]
Posted on April 19, 2010, 8:58 pm, by Rhys, under
DBA,
MySQL.
Now I’m back working with MySQL on Linux I’m starting to learn Bash scripting to automate various tasks. Here’s a very simple script demonstrating how to interact with MySQL from Bash. Just set the localhost, user and pwd (password) variables to something appropriate for the MySQL server you want to query. The script will use [...]
Posted on April 17, 2010, 3:01 pm, by Rhys, under
MySQL,
SSIS.
Getting data out of MySQL with SSIS is a snap. Putting data into MySQL has been a different matter. I’ve always done this in the past with a hodgepodge of ODBC, Linked Servers, OPENQUERY and the Script Task. All of these work well but they’re just not as convenient as loading files with the OLED [...]
Posted on March 14, 2010, 8:38 pm, by Rhys, under
MySQL.
Things have been rather quiet on this blog lately as I’ve just been finalizing the details for my new role as a MySQL DBA \ Developer. This may seem a little odd, considering TSQL is mentioned in my blog url, but I frequently blog about MySQL and have worked with it previously in a professional [...]
Posted on February 17, 2010, 9:56 pm, by Rhys, under
MySQL,
T-SQL.
There’s few SQL techniques you seem to keep in the cupboard gathering dust. I don’t think I’ve ever needed to use RIGHT JOIN outside of the classroom. I can recall using FULL OUTER JOIN, just once, to show an employer how not-in-sync their "integrated system" was. Today I broke my professional Non-Equi JOIN cherry! I [...]