Library tutorials & articles

MySQL Tutorial

Getting Started

When you start using MySQL, you use a command prompt to enter the SQL statement. The statements can be quite lengthy, and a pain to modify. The simplest way of using MySQL is to use files containing the SQL statements to perform. For example, if you want to create a table called, search, you could create a file called called, createSearchTable.sql and load this file from the command prompt rather than type in a lengthy SQL statement to create the table.

Loading SQL Statements from a File

The SOURCE command is used to load the file from the command prompt.

mysql> SOURCE createSearchTable.sql

The sequence \. is a shorcut name for the SOURCE statement. The following does exactly the same thing as the above SOURCE statement.

mysql> \. createSearchTable.sql

Logging Output

The TEE statement may be used to log output from your SQL statements to a text file. The following command copies all output to the file log.txt so you can examine the results of running your queries.

mysql> TEE log.txt

You can turn off loging using the NOTEE statement.

mysql> NOTEE

Comments

  1. 18 May 2009 at 17:00

    More good mysql examples:

    http://www.examplenow.com/mysql/alter

    --John

  2. 05 Aug 2008 at 13:25

     

    Dear Sir/ Madam

        I need your help, how to done replication method in MySQL Server. or if any automatic schedule scripting awailble. pls send my mail id as soon as possible.

    i will waiting for your mail

    email : vinaymeetu@ymail.com, or vinaywaiting4u@gmail.com,

    Regards

    Vinay.G.Liyar

  3. 01 Jan 1999 at 00:00

    This thread is for discussions of MySQL Tutorial.

Leave a comment

Sign in or Join us (it's free).

Gez Lemon I'm available for contract work. Please visit Juicify for details.

Related podcasts

  • Scaling Large Web Sites with Joe Stump, Lead Architect at DIGG

    Have you ever wanted to learn how top 100 web sites are architected? Deep Fried Bytes hosts Keith Elder and Chris Woodruff sat down with Joe Stump, Lead Architect at DIGG to discuss scaling large web sites, his life, development experiences and team building. Listen to the showThanks to our gues...

Events coming up

  • Dec 3

    The Auckland PHP December meetup

    Auckland, New Zealand

    Topic: Magento E-Commerce platform Speaker: Robert Popovic, LERO9, Robert is the Technical Director and co-founder of LERO9. Robert attended the Electrotechnical Faculty at The University of Belgrade where he graduated with a Masters in Computer Science and Information Technology. Robert has worked exclusively in the field of web and software development throughout his career.

Want to stay in touch with what's going on? Follow us on twitter!