demosthenes.info

I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter.

featured articles

popular favourites

Introduction to MySQL

My Widenius
My Widenius, the inspiration for the name MySQL.

MySQL is one of a number of popular website database solutions: other options include PostgreSQL and Firebird. The popularity of MySQL stems in large part from the fact that the database system both free and open source, and has strong community support. Most web hosting providers supply MySQL as the default database system for sites.

MySQL (pronounced either as “My SQL” or “My Sequel”) was developed by Ulf Michael (“Monty”) Widenius and David Axmark. “SQL” stands for Structured Query Language, the language in which its databases and tables are created, modified, and manipulated; the “My” is for Michael’s daughter. While the company originally formed to promote MySQL has undergone several mergers and acquisitions, and while there is a commercial version of MySQL available (used in high-demand sites such as Wikipedia, Facebook, Google, Flickr and Twitter), the open-source version is free, and always will be.

There are many tools for interacting with MySQL data, including the MySQL Workbench for Windows, Mac and Linux, but the most common encountered by web developers is phpMyAdmin, which is built into many web hosting packages and servers.

One of the primary advantages of SQL languages is that simple database queries are written in a very human-readable way. For example:

  1. SELECT * from camels where humps = 2 ORDER BY species

In this case, the query could be translated as “Select everything from the camels table that has a value of 2 in the humps field and provide the result in alphabetical order using the species field.”  As a result, Bactrian camels would be listed first (not that there are any other surviving two-humped camel species).

Database-as-language

One aspect of MySQL that can be confusing at first but valuable once grasped is that the language is the database; every action taken with the database is written in MySQL, as is the database itself. (Take a look at some of the printouts of the MySQL activity as you press buttons in phpMyAdmin, for example, or read an exported MySQL database as text).

You must be signed up in order to leave comments.

I would highly recommend for anyone wanting a really good tool for planning and creating MySQL databases to use the MySQL Workbench. Saved me a lot of organizational grief. =)

posted by Ian Carson

A question for you from the webtarded. How does one go about safely importing a MySQL database from an existing website to your local drive? I'm sure it's far simpler then I'm making it...I'm just leary of accidentally wiping the existing database and entering a fresh new circle of web hell.

posted by Curtis Johnson

Dudley StoreyIt's pretty easy to do so, Curtis: just export the database from the app controlling MySQL (typically done by choosing to export from phpMyAdmin, but it could be something else), save the .sql< file locally, start up your own server (Mac or Windows) go to phpMyAdmin, create a new blank database with the same name as the original, and choose Import. The result is two separate copies of the database running simultaneously: one local development copy, and one remote live version. I hope this helps!

posted by Dudley Storey

web developer guide

featured comment

by Aisling Brock in New Business Card Design

what i'm reading

A Feast for Crows: A Song of Ice and Fire: Book Four
A Feast for Crows: A Song of Ice and Fire: Book Four

what i'm watching

Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]
Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]

what i'm playing

Borderlands
Borderlands

what i'm hearing

Planets
Planets

blogs

podcasts

no ads ever

This blog is free of advertising, and always will be.

creative commons licensed

The content of this blog is free to use in whatever way you wish under the Creative Commons license.