Showing entries 11 to 14
« 10 Newer Entries
Displaying posts with tag: Beginner (reset)
Save time and energy: How to …

Save time and energy: How to:

Listening to “Highway to Hell” in an Oxford University computer lab on a sunday afternoon writing a MySQL blog can be legitimally defined by some as sick but thats what a geek calls a relaxing yet productive sunday afternoon.

For the sake of all those CLI ambassadors like myself, I wanted to share a couple of tips and tricks I use quite often when doing my mysql db administration work / scripting. I strongly suggest any mysql dba / dev use CLI simply because thats the one thing you should always have on any machine on which mysql is installed, be it Unix, Linux, Mac, Microsoft or whatever platform you are using.

Cancelling a query you are typing without exiting to the terminal:
`\c` – How many times you ended up hitting `CTRL+C` (default process kill in most OSes) in order to cancel a command, finding yourself going back to the console and having to connect again? Nuisence? Hell …

[Read more]
Slap’em

Giving a bunch of mysql instances something you do everyday and you might think ….. how should I do it? Write a bunch of selects and inserts manually? nahh that takes s**tload of time, should I run binlogs collected from a live system on my test server? nahh thats not practical nor is it real since it doesn’t contain selects, should I gather the general query log and try that out? nahhh  …..

MySQL has been kind enough to supply us with their mysql_slap which does the job for us and given I needed to do a proof of concept on monitoring a group of 4 circular replicated servers I wrote a small script which does the job of slapping them with a varying level of concurrancy, iterations, number of queries and connections for as long as you like.

Here it is and I hope some of you might find it useful for slapping their own test servers :).

#!/bin/bash

NumberOfConcurrentLoads=4

[Read more]
MySQL Installing: Binary tarball (.tar.gz) *nix based platforms

Installing MySQL is quite an easy thing to do, especially when done using pkgs, dmgs or exes. It gets just a tad more time consuming and brain intensive when installing a .tar.gz binary package. It is when you’re compiling MySQL source directly that you’ll need some planning and playing, but the latter is only done in particular cases such as when you’ll need a particular engine not shipped with a pre-compiled package etc.

Today we’re going through the steps required for a typical MySQL installation from a .tar.gz package on a *nix based platform, including the download, installation, configuration and securing.

Steps involved:
1. Download MySQL binary tarball from mysql.com
2. Create a folder structure where the installation will be held.
3. Install the package
4. Secure the installation

Step 1: Download MySQL

Go to http://dev.mysql.com/downloads/ and choose the particular …

[Read more]
Table Sizes

During the course of my daily work I occasionally search for mysql queries which are cool and helpful. I once found the following query on http://forge.mysql.com/:

SELECT table_name article_attachment,
engine,
ROUND(data_length/1024/1024,2) total_size_mb,
ROUND(index_length/1024/1024,2) total_index_size_mb,
table_rows
FROM information_schema.tables
WHERE table_schema = ‘dbname’
ORDER BY 3 desc;

A generally  lite version is:

select table_schema, table_name, (data_length)/pow(1024,2) AS ‘Data Size in Meg’, (index_length)/pow(1024,2) AS ‘Index Size in Meg’  from tables order by 3 desc;

You can add or remove columns etc and but this query shows the table size (data wise) index size, approx number of rows, size in MB etc. If you would like to know what else is available to add to this query, just do a “desc tables” while using the …

[Read more]
Showing entries 11 to 14
« 10 Newer Entries