Archive for November 13th, 2008|Daily archive page

MySQL backup by command line

# mysqldump -u username -p databasename > filename.sql
Compress the .sql file with gzip:

#gzip filename.sql

# mysqldump --all-databases > all_databases.sql

# mysqldump --user=root \
> --password=sa --host=localhost \
> database > backup.sql

# mysqldump --user=root --password=sa --host=localhost  database > /var/www/backup.sql

upload MySQL database – Command Line

Method 1 :

Create database for database_name and import the sql:
$ mysqladmin -p create database_name
$ mysql -p database_name < /var/www/html/database.sql

Method 2 :

Upload large SQL file by command line
copy SQL (database.sql) file to mysql/bin

D:……\>mysql -u root -p
Enter Password:

mysql>use database_name;
mysql>source database.sql

SQL ok.
Enjoy, may it will save someones some time!

How to create .htpasswd?

Create .htpasswd file from commandLine:

# htpasswd -c  /var/www/html/.htpasswd sandeep
New password:
Re-type new password:
Updating password for user sandeep

Add these lines to .htaccess file

## ALLOW ACCESS WITH PASSWORD OR NO PASSWORD FOR SPECIFIC IP/HOSTS ###
AuthType basic
AuthName “Ooops! Temporarily Under Construction…”
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /dev/null
Require valid-user # password prompt for everyone else
Order Deny,Allow
Deny from all
Allow from 192.168.64.5 # Your, the developers IP address
Allow from w3.org # css/xhtml check jigsaw.w3.org/css-validator/
Allow from googlebot.com # Allows google to crawl your pages
Satisfy Any # no password required if host/ip is Allowed

http://www.askapache.com/online-tools/htpasswd-generator/

http://www.php.net/manual/en/features.http-auth.php

http://corz.org/serv/tricks/htaccess.php