MySQL Introduction

MySQL is a common database for web based applications, primarily because it is free and there is a lot of community support for the database. The most recent version of MySQL (v5 as of this writing) has even added some “big boy” features to help create robust database applications.

MySQL Versions

The current release of MySQL is 5.

Notice from MySQL AB…

End of Product Lifecycle

Active development and support for MySQL database server versions 3.23, 4.0, and 4.1 has ended. However, for MySQL 4.0 and 4.1, there is still extended support available. For details, see http://www.mysql.com/company/legal/lifecycle/#calendar. According to the MySQL Lifecycle Policy (see http://www.mysql.com/company/legal/lifecycle/#policy), only Security and Severity Level 1 issues will still be fixed for MySQL 4.0 and 4.1. Please consider upgrading to a recent version (MySQL 5.0 or 5.1).

Linux Command Line Commands

Some basic MySQL commands you can execute from the Linux command line are shown below.

The # shown in the lines below represent your Linux prompt when logged in via SSH or Telnet. You do NOT type the #, just the command after it.

The lines starting with // are Cyber Sprocket comments for your reading pleasure.

What version of MySQL am I using?

// Show your current MySQL install version
# mysql -V
mysql  Ver 14.7 Distrib 4.1.22, for pc-linux-gnu (i686) using readline 4.3

In the result shown above we are using MySQL 4.1 with release version 14.7. When reviewing available features, the DISTRIBUTION (commonly referred to as the “version”, I know – very confusing) is what determines the level of MySQL you are using. Most developers want to know the base level, which is typically 3, 4, or 5. In this case we are using MySQL 4 (the first number after Distrib.

Dump my data schema…

mysqldump -p -n -d --single-transaction -u cybersprocket --databases cybersprocket_db > schema_2007-12-17.sql

In the example above we connect as user “cybersprocket” to the cybersprocket_db database and dump all the schemas for the tables and indexes into a file name schema_2007-12-17.sql. This file can then be loaded into another MySQL database to recreate the tables.

The flags:

  • -p = ask for the password for the user specified
  • -n = don’t output the create database command
  • -d = don’t dump any of the data (dump the schema only)
  • -u <username> = log in as this user
  • –databases <dbname> = extract from this database

Links

Related posts:

  1. Issues With MySQL
  2. Perl Introduction
  3. Powerful Data Insertion Features in MySQL
  4. Easy Documentation for Git, MySQL, PHP, et cetera
  5. PostgreSQL Introduction
0 Comment   |   Posted in Database,MySQL,blog by admin on June 08, 2009