[Koha-bugs] [Bug 10517] koha-restore fails to create mysqluser at mysql_hostname so zebra update fails

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri May 8 01:56:11 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10517

--- Comment #28 from David Cook <dcook at prosentient.com.au> ---
(In reply to Rudolf Byker from comment #25)
> OK, if you really need to support older versions, let's do it cleanly. Here
> is a way to check if the user exists:
> 
> EXISTS=$(mysql -uroot -p -s -e "select count(*) from mysql.user where user =
> 'asdf'" | tail -n 1)
> if [[ $EXISTS -gt 0 ]]
> then
>   echo "Now delete the user."
> fi

Sounds like a plan to me, although I think it would be better to create a new
function in koha-functions.sh, since we need to drop the user in koha-restore
as well as koha-remove. I think we batch too many SQL statements together for
these CLI utilities. 

But, I'm not planning on doing that work anytime soon. So don't feel obligated
to listen to that.

Ultimately what I was trying to say before was that koha-remove already uses
the DROP USER IF EXISTS syntax, so it seems fair to use it in koha-restore too,
even if it causes problems for people using older DB versions, since that
problem already exists in the master codebase.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list