Archive for the ‘Technology’ Category

Forum for MySQL Instaler

Сентябрь 13th, 2011

A few days ago we announced the availability of our new MySQL Installer for Windows.  While it’s a great first edition we know that you are going to have questions and we wanted the community to be able to help.  So we have created a new forum for the community to be able to discuss questions and issues with the new installer.

You can access the new forum here.

So, go forth and post!



PlanetMySQL Voting: Vote UP / Vote DOWN

Welcome to the world, MySQL Installer for Windows!

Сентябрь 8th, 2011

Well, our baby is born!  Some time ago we analyzed the feedback from users and customers and determined that far too many of our server installs were failing.  We have the best open-source database on the planet but no one can see that if we can’t get it properly installed.  Clearly something had to be done.

So, the new MySQL Installer is born.  It’s a Windows application that comes delivered in a bundle along with a version of the database server, applications like Workbench, connectors, samples, and documentation.  It includes some customized configuration screens that help with setting up the proper configuration files.

One of the great benefits of using the new MySQL Installer is that it comes with all the products very tightly integrated such as automatically creating connection entries in Workbench for the freshly installed server.  Our goal with MySQL is to have you up and running in 15 minutes.  With the new MySQL Installer, we’ve got that down to 3 minutes!

The best way to see all the greatness that is MySQL Installer is to download it yourself.  You can grab a copy here.

You can also see the Oracle press release on it here.

Thank you for trying out our new MySQL Installer and please let us know what you think!



PlanetMySQL Voting: Vote UP / Vote DOWN

Generating dimension data for dates

Июль 31st, 2011

Most analytical and BI databases have date dimension table(s). One frequently needs to generate and populate such data. I present a solution below for such data generation, written in Python. Please use different database drivers/modules to connect to your specific database server (MySQL, SQL Server, Oracle, etc.) for data population.

Notes:

1. It takes 2 parameters, start date and end date, in YYYYMMDD format, inclusive. Extensive error checking is built in, but let me know if you have comments/suggestions;

2. The script produce a Python dictionary (associated array) and print out its content;

3. The output includes dayNumber: a day’s position in a year. For example, 2011-02-01 is the 32ed day in 2011, therefore its dayNumber is 32;

4. The output includes weekNumber: a week’s position in a year. The week number in year is based on ISO standard. From documentation: the ISO year consists of 52 or 53 full weeks, where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year.

So, 2011-01-01 has the weekNumber 52, because it falls on a Saturday and belongs to the last week of 2010.

5. The output includes weekday information as well. 4 different variations are included:
Sunday 0, Monday 1, and so on
Sunday 1, Monday 2, and so on
Monday 0, Tuesday 1, and so on
Monday 1, Tuesday 2, and so on

6. The script requires the argparse module. It comes with Python 2.7. Python version prior to 2.7 does not have it by default, therefore you need to install it.

import argparse, sys, time
from datetime import date, timedelta
parser = argparse.ArgumentParser(description="Generating date dimension data")
parser.add_argument('-s', '--startDate', help='Start date in YYYYMMDD format', required=True, dest='startDate')
parser.add_argument('-e', '--endDate', help='end date in YYYYMMDD format', required=True, dest='endDate')
argList = parser.parse_args()
if (((not argList.startDate.isdigit()) or (not (len(argList.startDate) == 8))) or ((not argList.endDate.isdigit()) or (not (len(argList.endDate) == 8))) or (argList.startDate > argList.endDate)):
	print "Input(s) must be numeric in YYYYMMDD format and end date must not be earlier than start date"
	sys.exit (1)
try:
	startDate = date(int(argList.startDate[0:4]), int(argList.startDate[4:6]), int(argList.startDate[6:8]))
	endDate = date(int(argList.endDate[0:4]), int(argList.endDate[4:6]), int(argList.endDate[6:8]))
except ValueError:
	print "Input(s) must be valid date value in YYYYMMDD format"
	sys.exit (1)
start = time.time()
while startDate <= endDate:
	dateInfo = {'dateYYYYMMDD': startDate.strftime('%Y%m%d'), 'calDate': startDate.strftime('%Y-%m-%d'), 'calDay': startDate.day, 'calMonth': startDate.month, 'calYear': startDate.year}
	dateInfo['dayOfWeekSunday0Monday1'] = startDate.isoweekday() % 7
	dateInfo['dayOfWeekSunday1Monday2'] = startDate.isoweekday() % 7 + 1
	dateInfo['dayOfWeekSunday6Monday0'] = startDate.weekday()
	dateInfo['dayOfWeekSunday7Monday1'] = startDate.isoweekday()
	dateInfo['dayNumber'] = startDate.toordinal() - date(startDate.year - 1, 12, 31).toordinal()
	dateInfo['weekNumber'] = startDate.isocalendar()[1]
	print dateInfo
	startDate = startDate + timedelta(1)

PlanetMySQL Voting: Vote UP / Vote DOWN

MySQL Connector/Net 6.4.3 GA has been released

Июль 7th, 2011

MySQL Connector/Net 6.4.3, a new version of the all-managed .NET driver for MySQL has been released.  This is a GA release and is intended for full production deployment.

Version 6.4.3 is intended for use with versions of MySQL from 5.0 – 5.5

It is now available in source and binary form from [http://dev.mysql.com/downloads/connector/net/6.4.html] and mirror
sites (note that not all mirror sites may be up to date at this point of time
- if you can’t find this version on some mirror, please try again later or choose another download site.)
The release is also available for download on the My Oracle Support (MOS) and will be available from Oracle eDelivery.

** New features found in 6.4 include (please see release notes for more information) **

* Windows Authentication*
This release includes our new support for Windows authentication when connecting to MySQL Server 5.5.

* Table Caching *
We are also introducing a new feature called table caching.  This feature makes it possible to cache the rows of slow changing tables on the client side.

* Simple connection fail-over support *

We are also including some SQL generation improvements related to our entity framework provider.   Please review the change log that ships with the product for a complete list of changes and enhancements.

Enjoy and thanks for the support!



PlanetMySQL Voting: Vote UP / Vote DOWN

MySQL Connector/Net 6.2.5 GA has been released (legacy)

Июль 7th, 2011

MySQL Connector/Net 6.2.5, a update to our all-managed .NET driver for MySQL has been released.  This is an update to our legacy 6.2 version line. All new development should be using a more recent product such as 6.4.3.

Version 6.2.5 is intended for use with versions of MySQL from 4.1 – 5.1.  It is not suitable for use with MySQL 5.5 or later.

It is now available in source and binary form from [http://dev.mysql.com/downloads/connector/net/] and mirror
sites (note that not all mirror sites may be up to date at this point of time
- if you can’t find this version on some mirror, please try again later or choose another download site.)

This update includes more than 45 fixes from 6.2.4.  Please review the change log that is included with the product to determine the exact nature of the changes.

Enjoy and thanks for the support!



PlanetMySQL Voting: Vote UP / Vote DOWN

MySQL Connector/Net 6.1.6 (legacy update) has been released

Июнь 30th, 2011

MySQL Connector/Net 6.1.6, a update to our all-managed .NET driver for MySQL has been released.  This is an update to our legacy 6.1 version line. All new development should be using a more recent product such as 6.3.7. 

Version 6.1.6 is intended for use with versions of MySQL from 4.1 – 5.1.  It is not suitable for use with MySQL 5.5 or later.

It is now available in source and binary form from here and mirror sites (note that not all mirror sites may be up to date at this point of time
- if you can’t find this version on some mirror, please try again later or choose another download site.)

This update includes more than 35 fixes from 6.1.5.  Please review the change log that is included with the product to determine the exact nature of the changes.

Enjoy and thanks for the support!



PlanetMySQL Voting: Vote UP / Vote DOWN

MySQL Connector/Net 6.4.2 RC has been released

Июнь 30th, 2011

MySQL Connector/Net 6.4.2, a new version of the all-managed .NET driver for MySQL has been released.  This is a Release Candidate and is intended for testing and exposure to new features.  We strongly urge you to not use this release in a production environment.

Version 6.4.2 is intended for use with versions of MySQL from 5.0 – 5.5

It is now available in source and binary form from here and mirror sites (note that not all mirror sites may be up to date at this point of time
- if you can’t find this version on some mirror, please try again later or choose another download site.) 

New features found in 6.4 include (please see release notes for more information)

  • Windows Authentication — This release includes our new support for Windows authentication when connecting to MySQL Server 5.5. 
  • Table Caching — We are also introducing a new feature called table caching.  This feature makes it possible to cache the rows of slow changing tables on the client side. 
  • Simple connection fail-over support — We are also including some SQL generation improvements related to our entity framework provider.  

Please review the change log that ships with the product for a complete list of changes and enhancements.

Enjoy and thanks for the support!



PlanetMySQL Voting: Vote UP / Vote DOWN

Finding long running INNODB transactions

Май 30th, 2011

Notes:
1. Adjust shellCmd variable;
2. Adjust longRunningThreshold value as needed. It is measured in seconds;
3. The script prints out elapsed time since transaction started, MySQL thread id, and the kill statement. Just copy, paster, and then execute the kill statement if you want to terminate the long transaction(s);
4. No special libraries/modules needed, as long as there is a working mysql client;
5. re module is used for regex processing. Good place to find examples of regular expression search and grouping. A status variable is used to assist locating MySQL thread id once a transaction running longer than the defined threshold is found.

import re, shlex, subprocess
def runCmd(cmd):
    proc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
    out, err = proc.communicate()
    ret = proc.returncode
    return (ret, out, err)
shellCmd = """mysql -h hostName -e "show innodb status\\G""""
longRunningThreshold = 600
returnCode, stdOut, stdErr = runCmd(shellCmd)
targetTransactionFound = False
for line in stdOut.split('\n'):
    if targetTransactionFound:
        match = re.search(r'^MySQL\sthread\sid\s(\d+),', line)
        if match:
            print 'MySQL thread id', match.group(1), ' has been running for ', secondsTransactionElapsed, ' seconds'
            print 'To kill it, run: kill', match.group(1)
            targetTransactionFound = False
    else:
        match = re.search(r'^---TRANSACTION\s\w+,\sACTIVE\s(\d+)\ssec', line)
        if match:
            if (int(match.group(1)) > longRunningThreshold):
                targetTransactionFound = True
                secondsTransactionElapsed = match.group(1)

PlanetMySQL Voting: Vote UP / Vote DOWN

Install MySQLdb module for Python

Апрель 5th, 2011

This is mostly for my own future reference. It’ll be icing on the cake if it helps you!

This is geared for CentOS or Red Hat. Use apt-get or other packaging tools for different flavours of Linux.

1. Get Python module setuptools called easy_install. I love easy_install, by the way, sort of like CPAN for Perl modules;
2. To install MySQLdb package, you would think easy_install MySQLdb would do. But that is not the case. I hope the developer would fix that. Instead, you need:

easy_install MySQL-python

3. If you have build errors, you may need:
yum install python-devel or yum install gcc or both.


PlanetMySQL Voting: Vote UP / Vote DOWN

Install MySQLdb module for Python

Апрель 5th, 2011

This is mostly for my own future reference. It’ll be icing on the cake if it helps you!

This is geared for CentOS or Red Hat. Use apt-get or other packaging tools for different flavours of Linux.

1. Get Python module setuptools called easy_install. I love easy_install, by the way, sort of like CPAN for Perl modules;
2. To install MySQLdb package, you would think easy_install MySQLdb would do. But that is not the case. I hope the developer would fix that. Instead, you need:

easy_install MySQL-python

3. If you have build errors, you may need:
yum install python-devel or yum install gcc or both.


PlanetMySQL Voting: Vote UP / Vote DOWN