This post is the second in a series that I will be doing on MySQL Workbench Utilities – Administer MySQL with Python Scripts. You may want to read the first half of this post to understand how MySQL Workbench Utilities work and how you access the scripts. These scripts were written by Chuck Bell (a MySQL employee) and are available as stand-alone scripts (see Chuck’s …[Read more]
I write a fair number of scripts on this site and have posted a lot of code over the years. Generally if I am not pasting the code to be viewed on the webpage then I link to a file that a user can download; which leads to a lot of mish-mash code that doesn’t have a home. I’ve always kept the code files in a private SVN repo over the years but have recently moved them all to BitBucket Git repositories. So here they are: lots of code samples and useful bits of programming to save time.
Generic Shell Scripts: https://bitbucket.org/themattreid/generic-bash-scripts/src
Generic Python Scripts: https://bitbucket.org/themattreid/generic-python-scripts/src
Generic MySQL Stored Procs: …
Thursday, October 25, 2012
MySQL Cluster 7.3 Development Release: What’s New
Join the webinar to get all of the detail on MySQL Cluster 7.3 DMR and Early Access releases. Announced at the recent MySQL Connect conference, Oracle has published previews of MySQL Cluster 7.3.
MySQL Cluster 7.3 delivers more power and flexibility than ever before. The webinar will demonstrate each of these new features and show you how to get started.
Andrew Morgan, MySQL Product Management
Mat Keep, MySQL Product Management
MySQL Cluster 7.3 Development Release: What’s New web presentation.
Thursday, October 25, 2012: 09:00 Pacific time (America)
Thu, Oct 25: 06:00 Hawaii time
Thu, Oct 25: 10:00 Mountain time (America)
Thu, Oct 25: 11:00 Central time (America)
Thu, Oct 25: 12:00 Eastern time (America)
Thu, Oct 25: 16:00 UTC
I was digging through some old project code and found this script. Sometimes one finds oneself in an odd situation and needs to convert regular SQL, say from a MySQL database dump, into SQLite3 format. There’s not too much else to say, but here is a script that helps with the process. It can likely be improved but this handles the items that came up during conversion on initial runs.
#!/bin/sh #### # NAME: convert-mysql-to-sqlite3.sh # AUTHOR: Matt Reid # DATE: 2011-03-22 # LICENSE: BSD #### if [ "x$1" == "x" ]; then echo "Usage: $0 " exit fi cat $1 | grep -v ' KEY "' | grep -v ' UNIQUE KEY "' | grep -v ' PRIMARY KEY ' | sed '/^SET/d' | sed 's/ unsigned / /g' | sed 's/ auto_increment/ primary key autoincrement/g' | sed 's/ smallint([0-9]*) / integer /g' | sed 's/ tinyint([0-9]*) / integer /g' | sed 's/ int([0-9]*) / integer /g' | sed 's/ character set [^ ]* / /g' | sed 's/ enum([^)]*) / varchar(255) /g' | sed 's/ on …[Read more]
Tuesday, September 25, 2012
MySQL and PHP are two key components in the open-source LAMP stack, and are widely used by web developers. One day you launched a website, and it gradually gained traction and now serves hundreds times more traffic than day one. As a PHP developer, have you ever looked back and adjusted the MySQL configurations accordingly to meet the most current website load? Have you ever wondered if there are secret tips you might have missed or common mistakes that you could have avoided but never thought of? If you answered yes to either question, this presentation is for you!
In this live webinar, PHP & MySQL experts Ulf Wendel and
Johannes Schlüter will share the top 10 tips and mistakes for PHP
developers. After a quick overview of lesser known but cool
client and server features and plugins, and a recap of the
benefits of the relational database model, we quickly jump to the
hot irons, including:
This post is one in a series that I will be doing on MySQL Workbench Utilities – Administer MySQL with Python Scripts.
MySQL Utilities are a part MySQL Workbench. The utilities are written in Python, available under the GPLv2 license, and are extendable using the supplied library. They are designed to work with Python 2.x greater than 2.6. If you don’t have Workbench, you may download the MySQL Utility scripts from launchpad.net. You will also need to …[Read more]
Since I have been discussing scripting lately I thought I would continue with another topic I touched on briefly - backups.
I have written and modified the following script over the last few years. I have used it (and continue to use it) with multiple clients. It uses Percona's Xtrabackup to take the backup (although it can be easily modified to use mysqldump instead).
First the script
# run backup
echo ' ' > $report
echo 'The backup is now beginning:' >> $report
echo ' ' …
I've been involved in a number of interviews over the last few weeks as a client has been loking for a MySQL DBA. When you are looking for position as a DBA in a large scale environement there are some very important things you have to know.
You absolutely must know a scripting language. In a smaller environment this often isn't necessary. You will live and die by this in a large environment. I asked every applicant one specific question..if you had to change a mysql server variable on a pool of 100 mysql servers how would you do this? It's easy when it's one,two or even a dozen servers. just log in, change the my.cnf and change it "on the fly" if you can. Restart mysql if you can't.
You going to do that to 100 servers? It will take all day and be prone to failures. Scripting is the key here. Even just bash shell scripting can be very powerful. In another post I will cover a simple bash script to loop through a …[Read more]
A friend of mine was building a web site so his customers could view his current inventory of transportation containers, and he asked me for help on how to sort the rows of information that appeared on his site. So, in this post, I will give you a quick example on how to sort columns on a web page.
First, let’s start with an inventory database that we will build in MySQL:
Next, here are some SQL statements to populate the MySQL database with some sample data.
I was giving a presentation of the MySQL’s Enterprise Monitor* application to a client recently. I was demonstrating the “graphs” section of MEM, where you can monitor MySQL sessions, connections, replication latency and more with 60+ graphs. Usually, you view the graphs from within the MEM Enterprise Dashboard (via a web browser). But the client asked if there was a way to automatically download graphs. I wasn’t sure why he wanted to download the graphs (I didn’t ask), but I knew it wasn’t possible by using MEM alone. However, in the past I have written Perl scripts to automatically download files from web sites, so I thought I would see if it was possible with MEM.
*The MySQL Enterprise Monitor (MEM) continuously monitors your MySQL servers and alerts you to potential …