Saturday, March 2, 2013

How to Backup and Restore MySQL database in Linux

To take a backup of MySQL database or databases, the database must exist in the database server and you must have access to it. The format of the command would be.
# mysqldump -u [username] –p[password] [database_name] > [dump_file.sql]
The parameters of the said command as follows.
  1. [username] : A valid MySQL username.
  2. [database_name] : A valid Database name you want to take backup.
  3. [dump_file.sql] : The name of backup dump file you want to generate.
Example, Backup Database  :- 

# mysqldump -u suraj –p moodle > /home/suraj/moodle.sql
Example, Restore Database  :-
# mysql -u suraj –p moodle < /home/suraj/moodle.sql

Changing Apache2 Default Port in UBUNTU

Task: Change Apache port

Open /etc/apache2/ports.conf file, enter:
# vim /etc/apache2/ports.confOR
$ sudo vim /etc/apache2/ports.conf
To make the server accept connection on  port 81, enter:
Listen 81
Save and close the file And Open /etc/apache2/sites-enabled/000-default  :
# vim /etc/apache2/sites-enabled/000-default< VirtualHost *:80>  TO < VirtualHost *:81>
Save and close the file. Restart Apache 2 web server:
# /etc/init.d/apache2 restart
$ sudo /etc/init.d/apache2 restart