Tuesday, December 22, 2009

MySQL - Restore database

There are 2 ways to restore your MySQL database from sql dump file.


1st way to restore mysql database from sql dump file is using mysql web control panelphpMyAdmin
- Log into phpMyAdmin.
- Select your preference database on the left database navigation drop down list.
- Click on Import tab on the top.
- Select your sql dumb file at File to import
- Then select your mysql database charset (ex: Latin1, utf-8)
- and click GO and it’s done!

Do not use phpMyAdmin to import or restore your MySQL database if your MySQL database file is large. This is because, phpMyAdmin has limit on total upload size which depend on php setting. Besides, there is also maximum execution time which may cause browser to time out.

The solution to restore large mysql database from sql dump file is using unix/linux shell command.

To restore mysql database from a dump file, just type the command below:-

mysql -u #username# -p #database# < #dump_file#

Of course you need to replace #username# to your database username and #database# to your target database. and rename #dump_file# to your dump file file name (Ex: dump.sql) Once you enter the command, the linux/unix shell will prompt you for your database user password, just key in your database password and you are done.


Referring from:
http://www.techiecorner.com/31/how-to-restore-mysql-database-from-sql-dump-file/

Tuesday, December 15, 2009

MySQL - Create database

The command is simple just write mysqladmin in a CLI followed by the database name you want to create


# mysqladmin -u root -p create building
# mysql


 Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.82-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW databases;
+----------+
| Database |
+----------+
| mysql    |
| building|
| test     |
+----------+
2 rows in set (0.00 sec)
mysql>


You can also type the query in mysql> prompt like this

mysql> CREATE database building;
Query OK, 1 row affected (0.00 sec)

To show available databases in mysql use the command show databases on mysql> prompt.
Now use the database by typing USE building and then type SHOW tables to see what tables are available in the database

mysql> USE building;
Database changed

mysql> SHOW tables;
Empty set (0.00 sec)

Tuesday, November 17, 2009

Linux CLI - How to broadcast a message to all users - using wall

1. As the main input of wall is a file, we will first create our message file.Type :

$ echo 'Please note that in two more hours, and for one hour, you will not be able to use the SQL database, please save all your job before, and quit any application using it'> message.txt

2. OK, now we have our message ready, it is time to send it to the users

$ wall < message.txt

 Try yourself!!!

This Week [47] Motivation

If you're still hanging onto a dead dream of yesterday,
laying flowers on its grave by the hour,
you cannot be planting the seeds for a new dream to grow today.

Sunday, November 8, 2009

This Week [46] Motivation

If you want something you never had,
do something you have never done.


Don't go the way life takes you,
take the life the way you go.


And remember you are born to live and 
not living because you are born.

Sunday, November 1, 2009

Hobby - Cubik Cube 3x3

This is the faster and easier way I found how to solve this historical world phenomena.
There are only 6 algorithm to solve this cube.

1. Ri Di R D
2. U R Ui Ri Ui Fi U F
3. Ui Li U L U F Ui Fi
4. F R U Ri Ui Fi
5. R U Ri U R U U Ri
6. U R Ui Li U Ri Ui L

 Need to memories.
1. The center edges is the colour references
2. Remember the algorithm

F is front side
R is right side
L is left side
U is upper side
D is down side
i is inverter


Procudure :
1. Choose white side as your base side
2. Solve this white cross and first;two layer edges
3. When you get white cross on the top, use algorithm 1 to solve the first top layer.
4. The when the white base and 1st layer solve, turn the white base as a down side.
5. To solve 2nd layer, choose the edge and the center with the same color. Then,
   5a. if the edges opposite is same as a right side; use algorithm 2
   5b. if the edges opposite is same as a left side; use algorithm 3
6. After 1st and 2nd layer solve, you need to get upper side cross - yellow cross. To get this, use algorithm 4. Repeat the algorithm until you get the yellow cross.
7. Next use algorithm 5 to get 4 side's edges at 3rd layer same color as the center color. You will get top yellow cross and 3rd layer edges color on the right place.

8. Then use algorithm 6 to get 4 corner pieces at the right place. This time the color is at right place but did not match with the center color. But don't worry...
9. Repeat algorithm 1 to match the 4 corner pieces with the center color.

It is amazing.. it have done.. try yourself..

p/s - for Putrajaya resident.. give me a call for consultancy..

This Week [45] Motivation

One of the most satisfying thing in the life is the knowledge that there is always room fro growth within.
Every moment, everyday of our lives there are new things to learn.
There's always room for personal growth.

For a start, be true to yourself and accept this as a fact.
Personal growth achieves a level of heightened awareness that brings mind, body and spirit together in harmony.
This means being in better control of our lives.

As the year go by when we look back, be proud of the growth path we took on our journey through life. Let us take one day at a time, rejoicing and be glad of the blessings that come our way each day.