Thursday, February 11, 2021

How do I uninstall MySQL completely from ubuntu/Debian

sudo -i

service mysql stop


killall -KILL mysql mysqld_safe mysqld


apt-get --yes purge mysql-server mysql-client


apt-get --yes autoremove --purge


apt-get autoclean


deluser --remove-home mysql


delgroup mysql



sudo rm -rf /var/lib/mysql 

 

sudo apt-get remove --purge *mysql\*


sudo apt-get autoremove


sudo apt-get autoclean 




Tuesday, January 12, 2021

MySQL Autobackup of Koha in Debian/Ubuntu


I am showing you the easiest way to keep automate your koha db backupthat is the combination of MySQL Dumps and a cronjob.

Create a file called mysqldump.sh

mkdir /home/debian/backup/mysqldump.sh

copy the bellow line.

mysqldump -uroot -p******* koha_library | gzip > /home/debian/backup/koha_`date +%F`.sql.gz

save it

Test the script

 chmod +x /home/debian/backup/mysqldump.sh

Create and schedule a new cron job

Execute the script:

 sh /home/debian/backup/mysqldump.sh

And add the following line at the bottom of crontab -e

 30 23 * * * /home/debian/backup/mysqldump.sh

(This will execute the script every day at 23:30.)

------------------------------PERIODIC REMOVAL OF FILES--------------------------

tested on Debian/UBUNTU

  nano /home/debian/backup/mysqldump.sh

Add the line at the end: (this script will remove your Koha backfiles after 7 days)

  find /home/debian/backup/koha* -type f -mtime +7 -exec rm {}

--------------------------Auto Restart Mysql service------------------------------------------

And add the following line at the bottom of crontab -e 

30 23 * * * systemctl is-active  || systemctl start mysql.service

This will run every midnight at 11.30PM



Sunday, September 13, 2020

How to AutoBackup MySQL on Ubuntu/Debian

Here is an utility program called "automysqlbackup" that is available in the Ubuntu repositories.

sudo apt-get install automysqlbackup

Run the command by typing:

sudo automysqlbackup
/etc/lib/automysqlbackup ls
daily  monthly weekly
/etc/lib/automysqlbackup/daily ls
koha_library test

Saturday, September 12, 2020

Reset MySQL Root Password on Ubuntu 16.04 / 17.10 and 18.04/20.04 LTS

sudo /etc/init.d/mysql stop

sudo mkdir /var/run/mysqld/

sudo chown mysql /var/run/mysqld/

sudo mysqld_safe --skip-grant-tables &

=======

You may promnt something like this… you may have to press the Enter keykoha@ubuntu:~mysqld_safe Logging to syslog.

2017-12-25T16:49:30.554646Z mysqld_safe Logging to '/var/log/mysql/error.log'.

2017-12-25T16:49:30.578079Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

2017-12-25T16:49:32.568746Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended


[1]+  Done                    sudo mysqld_safe --skip-grant-tables

=======

sudo mysql -u root

use mysql;

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed


update user set authentication_string=PASSWORD("Newpassword")

where User='root';

flush privileges;
exit
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
Take Koha backup
Access mysql -h 127.0.0.1 -P 3306 -u root -p
Backup of Koha_library
mysqldump -u root -p koha_library > koha_library.sql

Friday, April 24, 2020

Setting up the Z39.50 and SRU Server for KOHA

open terminal in Ubuntu or Debian

koha-z3950-responder --enable <instancename> for example library

Start the server with:
koha-z3950-responder --start <instancename>

if any error occurred , download z3950_responder.pl from below


copy this file into  /usr/share/koha/lib/misc/z3950_responder.pl 

if the misc is not available in lib directory then create new directory and copy             z3950_responder.pl in it.

then issue the command koha-z3950-responder --start <instancename>

your z39.50 responder will start.

The default port is 2100 (if you need to change, follow the given instruction)

Modify config.xml ie.g. to change the listening port from the default (2100). pqf.properties defines rules for translating the incoming Z39.50 queries, and may need to be customized for any custom search fields.



Monday, March 9, 2020

Set Time/Date/Timezone in Ubuntu Linux

Set date from the command line
date +%Y%m%d -s "20120418"
 
Set time from the command line
date +%T -s "11:14:00"
 
Set time and date from the command line
date -s "19 APR 2012 11:14:00"
 
Linux check date from command line
date
 
Will show you something like this:

Thu Apr 19 15:17:34 BOT 2012
 
Set hardware clock


hwclock --show
 
Will output something like this:

Thu 19 Apr 2012 03:23:05 PM BOT  -0.785086 seconds
Now check the system clock

date
Will output something like this:

Thu Apr 19 15:26:41 BOT 2012
Let's set the hardware clock to local time:

hwclock --set --date="2012-04-19 16:45:05" --localtime
If you want to set it to UTC time use:

hwclock --set --date="2011-04-19 20:45:05"  --utc
 
Reference: https://www.garron.me/en/linux/set-time-date-timezone-ntp-linux-shell-gnome-command-line.html   

Schedule Restart ​PM2 Service for DSpace 9.2 on Ubuntu

Start Manually pm2 start /home/dspace/dspace-angular-dspace-9.2/dspace- ui.json   Find PM2 binary path which pm2 Add DAILY resta...