MySQL

and how to talk to it


You know a thing or two about rdbms and sql - so you decide to have a look at one of the favorites among opensource relational database systems: mySQL. And you have no clue - you don't even know where to start looking.
Been there done that, took notes :

Quick Start Guide

It's quite easy to install mysql on a Linux server. The main thing to remember is to set a root password, and configure the server to bind to a real address in stead of the local loopback address.

	## my.cnf
	# listen port : bind to real address i.s.o. local loopback
	bind-address            = 192.168.0.20
	

You may also want to decide on where (directory, mount point, partition) you want to keep your database files, ... (explained here).

Creating a mySQL database

mySQL can work with nice sql front-ends or web-based admin tools such as phpMyAdmin, but to quickly hack together a simple database, you can also just use the mysql command line tool :

mysql -u root mysql -p


CREATE DATABASE dbSillyNetMon
CREATE TABLE dbSillyNetMon.tblSessions ( 
	session_key DOUBLE, 
	hostname CHAR,
	user_name CHAR, 
	session_date CHAR(10), 
	time_start CHAR(8), 
	time_stop CHAR(8)
	);

-- to modify existing tables :
ALTER TABLE dbSillyNetMon.tblSessions  MODIFY hostname CHAR(48);
ALTER TABLE dbSillyNetMon.tblSessions  MODIFY user_name CHAR(48);

-- account for application : account creation + privs in 1 statement
GRANT SELECT,INSERT,UPDATE ON dbSillyNetMon.* 
	TO 'netmon'@'%' IDENTIFIED BY 'netmon_password';

ODBC

On a windows client, you can not natively connect to a MySQL database, but you can use an ODBC driver

Front-Ends for MySQL

MySQL WorkBench
MySQL Workbench is a next-generation visual database design application that can be used to efficiently design, manage and document database schemata
MySQL GUI Tools Bundle
the MySQL GUI Tools Bundle for 5.0 includes the following products :
-----
OpenOffice.org
Using the OpenOffice.org Office suite (Base, Writer, ...) as a database front-end for simple database maintenance and data input, and as a report generator.

Links : resources and references

MySQL
Databases and SQL
Koen Noens
March 2008