MySQL Cheat Sheet

This tutorial describes most popular SQL commands and cheets.
Provided by Leumas Naypoka / www.apphp.com

Here are the most commonly used SQL commands and the most commonly used options for each. There are many more commands and options than listed here. In other words, the syntaxes as I have listed them are far from complete. See the links at the bottom for more complete syntaxes and more commands.

This sample demonstrates how to do a backup of your database.
mysqldump -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql

This sample shows how to create a database structure without data.
mysqldump --no-data - u USER -pPASSWORD DATABASE > /path/to/file/schema.sql

If you want to dump only one or few tables.
mysqldump -u USER -pPASSWORD DATABASE TABLE1 TABLE2 TABLE3 > /path/to/file/dump_table.sql

Create a backup and archive it.
mysqldump -u USER -pPASSWORD DATABASE | gzip > /path/to/outputfile.sql.gz



To be continued...

Comments


Please post only comments related to the original tutorial. Be polite and helpful, do not spam or offend others.
Create Your Free Account
Please remember that this information is essential to use our services correctly.
After creating the account you will be able to download all of our FREE products.
Fields marked with * are mandatory






Please send me information about updates, new products, specials and discounts from ApPHP!
We recommend that your password should be at least 6 characters long and should be different from your username/email. Please use only letters of the English alphabet to enter your name.

Your e-mail address must be valid. We use e-mail for communication purposes (order notifications, etc). Therefore, it is essential to provide a valid e-mail address to be able to use our services correctly.

All your private data is confidential. We will never sell, exchange or market it in any way. Please refer to Privacy Policy.

By clicking "Create Account", you are indicating that you have read and agree to the ApPHP Terms & Conditions.

Quick Registration with: Facebook / Google