Search This Blog

Monday, April 16, 2012

How to restrict website using firestarter

Qs. Can we restrict website access using firestarter. The requirement is
as follows:
We are using a internet shared system using firestarter. This system
is kept for public use in a museum. The administrator over there wants
only access to 2-3 websites which is related to the museum rest site
should be accessible. Can we do it through firestarter?

Ans: To restrict all websites except few, provide the websites in "Outbound traffic policy" -> Restrivticve by default" -> "Allow connectiosn to host"
The websites listed under this site only will be allowed now and all other websites are restricted

Thursday, April 12, 2012

Backing Up and Restoring A MySQL Database

This tutorial explains the how to backup and restore the MySQL Database. Databases are used to store large amount of precious data and it becomes very important to Backup your data. In case case of some hardware or software failures  backup data can be used to restore the Database.

Backing Up MySQL Database

MySQL database backup can be accomplished in two ways:

a) Copying the raw mysql database files &
b) Exporting tables to text files

Copying the MySQL database files

MySQL uses the same table format on different platforms, so it's possible to copy MySQL table and index files from one platform and use them on another without any difficulties (assuming, of course, that you're using the same version of MySQL on both platforms).

Exporting tables to text files

The MySQLDump is handy utility that can be used to quickly backup the MySQL Database to the text files. To use the MySQLDump utility it is required to logon to the System running the MySQL Databse. You can use Telnet to remotely logon to the system if you don't have the physical access to the machine.

The syntax for the command is as follows.

mysqldump -u [Username] -p [password] [databasename] > [backupfile.sql]
[username] - this is your database username
[password]- this is the password for your database
[databasename] - the name of your database
[backupfile.sql] - the filename for your database backup

Let's discuss the example of backing up MySQL Database named "accounts" into text file accounts.sql. Here are the scenarios of taking the backup assuming that both user name and password of the database is "admin".

a) Taking the full backup of all the tables including the data.
Use the following command to accomplish this:
mysqldump -u admin -p admin accounts > accounts.sql

b) Taking the backup of table structures only.
Use the following command to accomplish this:
mysqldump -u admin -p admin --no-data accounts > accounts.sql

c) Taking the backup data only.
Use the following command to accomplish this:
mysqldump -u admin -p admin --no-create-info accounts > accounts.sql

Restoring MySQL Database

Restoring the MySQL is very easy job. You can use the following to command to restore the accounts database from accounts.sql backup file.

mysql - u admin -p admin accounts < accounts.sql

In this tutorial you learned how to take the backup of your MySQL Database and restore the same in the event of some database crash or on some other machine.


Source: http://www.roseindia.net/mysql/mysql_backup_restore.shtml

How to get mysql Database dump and restore database


1.You can use following commands for taking mysql dump in .sql format
go to /var/lib/mysql

search for the database whose dump you want.

ls -l | grep database_name

mysqldump database_name > database.sql

2. If the mysql dumpis available and you want to restore that you need to use following command for that

cd /var/lib/mysql

check the database name where you want to restore the mysqldump
ls -l | grep database_name

mysql database_name < database.sql


Tuesday, April 10, 2012

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)


First: Make sure that the owner of /var/lib/mysql and its files and subdirectories is mysql user of mysql group

to do that run the following command:

chown mysql.mysql -R /var/lib/mysql/*

Second: change write permissions to rwxr-xr-x (755) for mysql directory, and all its files and subdirectories, by running the following command:

chmod 755 -R /var/lib/mysql/*

now start mysql service by running the following command (Red Hat and may fedora):

service mysql start


the error message should disappear and should output:
Starting MySQL. [ OK ]

Source: http://forums.mysql.com/read.php?11,27769,213014

Sunday, April 1, 2012

how to checkout file/folder from svn


1. In svn is not installed, install it by following command

     sudo apt-get install subversion
2. Now to download file/folder user following command
   
 $svn checkout url_path_of_file/folder

eg to download speech_tools from 
svn://svn.berlios.de/festlang/trunk/speech_tools  use following command 

$svn checkout
svn://svn.berlios.de/festlang/trunk/speech_tools
  

Friday, March 16, 2012

How to restore MySQL database from sql dump file?

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 panel – phpMyAdmin
- 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.

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

Enabling .htaccess file in Linux

Enabling .htaccess file

.htaccess file is a powerful file that can be used to control and customize a site server behavior without editing the core Apache module. By default, the .htaccess functionality is turned off and all instances of .htaccess files are completely ignored. The server will not even attempt to read .htaccess files in the filesystem.

To enable .htaccess file, open up the settings file that you have created earlier:

gksu gedit /etc/apache2/sites-available/default

Scroll down the file until you see the part "<Directory /home/user/public_html/>". Underneath that line of code, change AllowOverride None to AllowOverride All.

apache-allowoverride

Save and exit the file.

In case of local host you may found above section of code as follows:


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/

Also, if you need to use rewrite rules you need to enable them first. You do that with the following command.

sudo a2enmod rewrite
Prior to running that command you may get an error similar to the following.
[Tue Apr 14 14:23:34 2009] [alert] [client 127.0.0.1] /var/www/wiki/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Finally, don't forget to restart Apache.

sudo /etc/init.d/apache2 restart