Usefull Linux commnad

For Removing a program, apply this commnad:

apt-get –purge remove phpmyadmin


Koha Digester Recovery Plan

Manual Recovery Plan

You should take koha mysql database backup in regular basis.
You can take koha database backup by running the following command:

mysqldump -u root -pserver koha > your_desired_folder/koha.sql

Take your necessary opac databases and files backup.

You can up koha.sql file by running the following command:

mysql -u root -pserver koha < your_desired_folder/koha.sql

Mysql usefull Command

Change mysql root password

# mysqladmin -u root -pcurrentpassword password ‘newpassword’

$ mysqladmin -u root -p’oldpassword’ password newpass


mysql> UPDATE user SET password=PASSWORD(‘newpassword’) WHERE user=’root”;


# mysqladmin -u root password ‘newpassword’
[Note: There is no currentpassword for root in this example]

Change MySQL Regular User (non-root) Password

# mysqladmin -u nur -pcurrentpassword password ‘newpassword’


mysql> UPDATE user SET password=PASSWORD(‘newpassword’) WHERE user=’nur’;

php mysql and java script learning

Web tutorial: 

Auto mysql backup setting

/usr/bin/mysqldump -uUSERNAME -pPASSWORD DATABASE > FILEPATH/db_backup_$(date +\%Y-\%m-\%d-\%H-\%M).sql

1. The command that is to be executed (often a user written script or a UNIX command)
2. How often the command is to be executed (what days, months, dates, hours etc etc)
There are following different format to get the backup of mysql database using cron job
1) Simple cron job syntax to take database backup
* * * * * /usr/bin/mysqldump -u databaseusername databasename -ppassword > /path of database store.sql
2) Compress the database backup in gz format
* * * * * /usr/bin/mysqldump -u databaseusername databasename -ppassword|gzip > /path of database store.gz
3) Compress the database backup in bz2 format
* * * * * /usr/bin/mysqldump -u datbaseusername databasename -pdatbasepassword|bzip2 -c > /path of database store.bz2

/usr/bin/mysqldump -u [user] -p [pass] [database] > /usbdrive/backup-$(date +'\%F').sql

Replace and insert data in mysql
update items set barcode = replace(barcode, ‘MBA’, ‘MBA00’) where barcode like ‘MBA%’ and length(barcode)=6;

Add leading zeros with existing data
update items set barcode = concat(’00’,barcode) where length(barcode) =4;
update items set barcode = concat(’00’, barcode) where (length(barcode)=4 and barcode not like ‘PH%’);

Update field in mysql
update items set location = ‘REF’ where barcode like ‘%R%’;

Adding sudo user in dabian and changing user password

user password changing
For a user named koha:

sudo passwd koha
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Adding sudo privileges

Not this way: sudo vi /etc/sudoers

# This file MUST be edited with the ‘visudo’ command as root.

This way:

$ su root
# visudo

# User privilege specification
root ALL=(ALL) ALL
koha ALL=(ALL) ALL (Add here, like koha user)