Place to share anything

Free Software, Download, Tips and Tutorials, Cars, Notebook, Review

How To Backup and Restore MySQL into a file

To prevent any data loses, most Database administrator must have backup their database frequently. This tutorial will show you how to backup MySQL Database into a file and also how to restore the database from the backup file.

Backup the database

Backing up your database is a very important system administration task, and should generally be run from a cron job at scheduled intervals. We will use the mysqldump utility included with mysql to dump the contents of the database to a text file that can be easily re-imported.

Okay, this is the syntax or command to backup MySQL database into a file

 mysqldump -h localhost -u root –p mypassword databasename > dumpfile.sql

For example, I have a local database named “test” and the password is “gambliscom” then I have to execute this command below to backup my database into a file named “mybackup”

(more…)

  • Share/Bookmark

Create and drop database syntax in MySQL Server

Its an easy way to create a new database in MySQL Server using syntax or command line. In this MySQL tutorial, we will learn how to create a new database and how to drop the selected database using command line in MySQL. To create a new database the basic syntax is:

CREATE DATABASE <database>;

Here is some example create and drop the database:

1. Create a new database named mydatabase

mysql> CREATE DATABASE myDatabase;
Query OK, 1 row affected (0.03 sec)

2. Drop myDatabase

mysql> drop database myDatabase;
Query OK, 0 rows affected (0.01 sec)

Its easy right..? See you in the next tutorial.

Incoming search terms for the article:

  • Share/Bookmark

Basic MySQL Query-Introduction to SELECT Statement

In MySQL, SELECT statement is used to pull or retreive any information from MySQL server. This statement include but not limited to get table list, table data or contents and many more. This whole process is usually called by Query.

There is general specific form ot this statement.

SELECT what_to_select
FROM which_table
WHERE conditions_to_satisfy;

what_to_select is what kind of data you want to pull from given table. It can be a specific column or you can use wildcard (*) to select all columns.
which_table is your table name
WHERE clause is optional. You can specify filters after this claus.

And don’t forget to end your statement with semicolon(;).

Example:

SELECT * FROM employee WHERE ID=5;

The command above will return a set of data that contains all columns of the table employee where the column ID is 5.

Its pretty easy right..?

Okay see you next.

Incoming search terms for the article:

  • Share/Bookmark