470,868 Members | 1,747 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Introduction to MySQL

By Blair Ireland
Senior Editor, TheScripts.com

Modern day web sites seem to be relying more and more on complex database systems. These systems store all of their critical data, and allow for easy maintenance in some cases.

The Structured Query Language (SQL) is a very popular database language, and its standardization makes it quite easy to store, update and access data. One of the most powerful SQL servers out there is called MySQL and surprisingly enough, its free.

Some of the features of MySQL Include: Handles large databases, in the area of 50,000,000+ records. No memory leaks. Tested with a commercial memory leakage detector (purify). A privilege and password system which is very flexible and secure, and which allows host-based verification. Passwords are secure since all password traffic when connecting to a server is encrypted.

So how does this benefit you? Well, you can now manage a database driven web site for free. Yes, free.

Even several corporate web sites have started using MySQL, just check out http://www.mysql.com/users.html and you will see what I mean.

For more information about MySQL, check out the web site at http://www.mysql.com/

Anyway, this multi-part tutorial will be on the various basic commands and functions available within MySQL.

Unless you are sitting in front of your server (which you likely aren't), you are going to have to telnet into the server. Once you are in, proceed to the directory where you can find the MySQL files.

At the prompt type in something along the lines of the following syntax to login

mysql [-h host_name] [-u user_name] [-p your_pass]

Usually you have to ask your web host for a MySQL user name and password, as this is the kind of service you would have to inquire about in the first place.

Personally, when I log in to mysql, the first thing is see is:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is XXXX to server version: 3.22.22

Type 'help' for help.

Once you type help, you will see:

MySQL commands:
help (\h) Display this text
? (\h) Synonym for `help'
clear (\c) Clear command
connect (\r) Reconnect to the server. Optional arguments are db and host
edit (\e) Edit command with $EDITOR
exit (\q) Exit mysql. Same as quit
go (\g) Send command to mysql server
ego (\G) Send command to mysql server; Display result vertically
print (\p) Print current command
quit (\q) Quit mysql
rehash (\#) Rebuild completion hash
status (\s) Get status information from the server
use (\u) Use another database. Takes database name as argument

These usually help you out when you get lost during your MySQL Adventures.

All commands will be issued from the mysql> prompt from now on.

  Datatypes »