Archive for the ‘ MySQL ’ Category

Transfer data from MySQL to SQL Server Using SSIS

I will be doing a series of tutorials (some simple, some more involved) in SSIS in the next little while. In addition to step by step instructions, I will also be providing the video tutorial equivalents which will be posted at the Black Ninja Software website. Once the video tutorials are up, I will be updating the individual links.

Now for this simple problem. You have a MySQL database, and you want to be able to dump data from it to SQL Server using SSIS.

Here are the steps:

1. If you haven’t already, download and install MySQL Connector for ODBC.

2. Create a DSN for your MySQL

a. Go to Start > Administrative Tools > Data Sources (ODBC)
b. Create a new User DSN (in my case I called it MySQL55)





Read the rest of this entry »

VN:F [1.9.22_1171]
Rating: 9.5/10 (4 votes cast)
VN:F [1.9.22_1171]
Rating: +5 (from 5 votes)

Generating Random Data for SQL Server and MySQL

SQL Server – uses NEWID() in ORDER BY

   1: -- using the AdventureWorks Database
   2: SELECT
   3:     TOP 10
   4:     DepartmentID,
   5:     [Name]
   6: FROM
   7:     HumanResources.Department
   8: ORDER BY
   9:     NEWID()
  10:

MySQL – uses RAND() in ORDER BY

   1: SELECT
   2:   `Code`,
   3:   `Name`
   4: FROM
   5:   `Country`
   6: ORDER BY
   7:   RAND()
   8: LIMIT 10;
VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

MySQL EXPLAIN Cheat Sheet

Came across this handy cheat sheet for MySQL EXPLAIN:

http://www.beberlei.de/mysql_explain.html

EXPLAIN is a clause in MySQL that explains how a SELECT statement will be executed, and allows one to determine whether the indexing scheme is effective or not.

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

Indispensible MySQL Resources

Doug Bromley of Straw Dogs have posted 20 Indispensible MySQL Resources, which include

  • SQLYog
  • phpMyAdmin

In addition, the following tools are in my MySQL toolbox if I am wearing my MySQL DBA hat on:

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

How to increase an InnoDB log file size

(MySQL 5.0)
Had a question from a student:

Problem:
He is trying to increase the innodb log file size by altering his .ini file.
After he makes the changes to the .ini file, he attempts to restart the server but fails.

Error messages indicate:
-ib_logfile0 has a different size
-can’t initialize database

Solution:
The solution was posted by Jay Pipes in the MySQL forum (http://forums.mysql.com/read.php?22,32004,32014#msg-32014). Essentially MySQL tries to look for the log file that had the original size, doesn’t find it, aborts the restart.

Solution is to rename the log files. MySQL will recreate the appropriate log files with the appropriate sizes.

#assuming you have a Linux system and you installed MySQL using an RPM#otherwise your MySQL install might be in /usr/local#if you can't figure out where your install folder it, "find" is your friend $/etc/init.d/mysql stop$mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak$mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak$/etc/init.d/mysql start$
VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
`