Showing posts with label MariaDB. Show all posts
Showing posts with label MariaDB. Show all posts

How to restore the deleted records [Command line method]


When you delete a record, Koha doesn't immediately erase it from the database; it moves it to a deleted table. These are the tables where deleted records are stored:
deletedbiblio, deletedbiblio_metadata, deletedbiblioitems, and deleteditems.

Find the deleted Information

Since the records are no longer in the main catalogue, you need to look in the trash tables. The best way to do this is to run a simple report.

Go to Reports > Guided Reports > Create from SQL.

Give it a name like Find Deleted Records.

Paste this SQL query to see everything in the trash: 

SELECT biblionumber, title, author FROM deletedbiblio

Run the report and find the biblionumber of the records you deleted. Only a few numbers, write those numbers down.

Patron searches give 500 error

Problem statement: The following error message when searching for patron names.

Something went wrong when loading the table.
500: Internal Server Error. 
Month out of range.
Month out of range.
Month out of range.
Month out of range
.

Reason: The date_renewed column has some proper dates, some NULLs and some 0000-00-00.

Solution: Uupdate borrowers set date_renewed = NULL where date_renewed = '0000-00-00'. Enter into the MariaDB and apply the following commands,

sudo mysql -uroot -p
use koha_library;
UPDATE borrowers
SET date_renewed = NULL;

Idea courtesyMahesh Palamuttath

Reference


Fix MySQL/MariaDB socket error

Socket file helps to facilitate communication between different processes of the MySQL and MariaDB server. The file associated with the process is, mysqld.sock and is located at the folder, /var/run/mysqld/. Due to many reasons, MariaDB cannot establish a connection with the socket file. Sometimes socket files are missing from the location. It results in the stopping of the MariaDB service. The problem with the socket file also affects the working of Koha. Often Koha screen shows the following error on the screen.

Possible solutions

We can try to apply three solutions to evoke socket files; restarting the MariaDB service, changing user permissions, and reinstalling MariaDB. 

Solution 1: Try to restart the MariaDB service and check whether it's working.

sudo systemctl start mariadb

Refresh the Koha page. If it works, it means the socket file works. If it does not open, we go to the next solution.

Solution 2: Next, we will check whether the mysqld. sock file missing or not. Apply the following command,

ls -a /var/run/mysqld

The file is there, we can see a file with the name, mysqld.sock. If the file is missing from there, the reason may be that MariaDB has no proper permissions to create it. Give the directory permission to MariaDB users to make necessary changes.

sudo chown mysql:mysql /var/run/mysqld/
sudo chmod -R 755 /var/run/mysqld/

Restart the MariaDB service,

sudo systemctl restart mysql

If it is reluctant to start the service and shows the error, find other ways to solve it. The last resort is to reinstall the MariaDB.

Solution 3: Reinstall MariaDB

The first step is the uninstall the MariaDB without removing the Koha databases  (e.g. koha_library). The default location of the data directory of MariaDB is at /var/lib/mysql/, where we can see the Koha database directory.

The location of MariaDB data directory, /var/lib/mysql/
Apply the following commands to uninstall MariaDB,

sudo apt purge "mariadb*" -y

When it asks for deleting databases, give the answer No. It will retain the Koha database.

Apply the following command to remove unwanted packages after the uninstallation of MariaDB.
sudo apt autoremove -y

Apply the following command to reinstall the MariaDB,

sudo apt-get install mariadb-server mariadb-client

I faced the socket problem with MariaDB 10.3 on Ubuntu 20.04. I used the opportunity and installed a higher version of MariaDB (10.04) by adding a repository. The download page in the MariaDB home page gives you instructions to install a higher version of the package. Please check it, https://mariadb.org/download/?t=repo-config

After the successful installation of MariaDB, open the Koha Staff Client and check the page loads or not.

References

How To Troubleshoot Socket Errors in MySQL https://www.digitalocean.com/community/tutorials/how-to-troubleshoot-socket-errors-in-mysql

MariaDB installation - dependency problems and failed to start service https://mariadb.com/kb/en/mariadb-installation-dependancy-problems-and-failed-to-start-service/

Install MariaDB 10.4 on Debian 9 (Stretch)

Image courtesy: mariadb.org
Debian 9 (Stretch) software repository contains MariaDB 10.1. Version 10.1 is a little bit old. It's possible to install the latest version of MariaDB (version 10.3 or 10.4) on Debian 9 to get good database performance. Latest versions of MariaDB free from the auto-increment bug. This version is free from Here is the method to install MariaDB 10.4 on Debian 9 when preparing system for Koha installation. This method can apply for a fresh installation of Koha. Don't try this method to install MariaDB on an existing installation of Koha.

Install dirmngr

sudo apt-get install software-properties-common dirmngr

Importing the MariaDB GPG Public Key and install MariaDB
Apply following commands,

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://espejito.fder.edu.uy/mariadb/repo/10.4/debian stretch main'

sudo apt update

sudo apt-get install mariadb-server

Assign Root password for MySQL
If password asks during the installation process, enter the password in the window. Apply following command, if the password window did not appear during the installation,

sudo mysqladmin -u root password newpass

[Replace 'newpass' with your own new MySQL Root password]

References
https://mariadb.com/kb/en/library/installing-mariadb-deb-files/#importing-the-mariadb-gpg-public-key

https://downloads.mariadb.org/mariadb/repositories/#distro=Debian&distro_release=stretch--stretch&mirror=rise&version=10.4

Install the latest version of MariaDB with Koha

Image courtesy: Mariadb.org
MariaDB is a community fork of MySQL. Latest versions of Koha support MariaDB. Current versions of Ubuntu and Debian repository provide the old version of MariaDB. Users can add the latest version of MariaDB by adding the software repository. The following method can install MariaDB 10.3 with an existing Koha installation on Ubuntu 16.04 LTS. MariaDB installation details can be found at mariadb.org

Installation of MariaDB
The process includes adding the MariaDB repository information to Ubuntu and install the database. Take a backup of the Koha database before the installation process.

Upgrade Ubuntu
Open a terminal and apply the following commands one by one;

sudo apt-get update 
sudo apt-get upgrade

Add MariaDB repository
Login as Root User.

sudo su

apt-get install curl software-properties-common dirmngr

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Install MariaDB

apt-get install mariadb-server

Need to enter the Root password when the installation process ask. Give the same old MySQL root password.

After the installation try to Log into MariaDB,

sudo su
mysql -uroot -p

You will get following message,

ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded

Go to the following link and apply the solution mentioned in the forum to fix it,

https://askubuntu.com/questions/705458/ubuntu-15-10-mysql-error-1524-unix-socket

Reference
https://mariadb.com/kb/en/library/mariadb-package-repository-setup-and-usage/

Enable Memcached with Koha

What is Memcached?
"Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load" (https://memcached.org/).

Why we should use Memcached with Koha?
Memcached can boost the performance of Koha.

I have tried to enable Memcached with Koha versions 17.05.x to 18.05.x.

Check Memcached working with Koha

Open Koha > About Koha > Server Information

The red flag indicates that Memcached not working

Delete records in Koha

In certain occasions need to empty bibliographic, patron and transaction details from Koha database and clean the installation to start the process again. The user has to go to Koha database and empty the concerned tables.

Log into MySQL
Apply following commands to login to the MySQL database;

sudo su
mysql -uroot -p
use koha_library;


Delete circulation entries from databse tables (DBMS auto increment)

Certain records reluctant to Checkin due to DBMS auto increment problem. In such cases, the transaction remains in the tables. Developers still working on the solution. Here is a temporary solution. I tried this steps on Koha installed on Debian 8,9 and Ubuntu 16.04 with MySQL and MariaDB Server.

Symptoms of DB increment problem

Record reluctant to check-in.