It is counter-intuitive to have an option switch --use-db which tries to create a db (what is --create-db for then?) and also a db user... It is of more use to just pass it the data for using an already created db with its credentials.
Created attachment 41424 [details] [review] Patch - remove CREATE USER when koha-create --use-db Please, check the attachment.
(In reply to Yarik Dot from comment #1) > Created attachment 41424 [details] [review] [review] > Patch - remove CREATE USER when koha-create --use-db > > Please, check the attachment. I think the behaviour should be: - If the user passes DB parameters (user, pass, hostname, dbname), use them to configure the instance. This needs more parameters to be added to koha-create. hostname should default to 'localhost' if ommited. - If some of the new parameters is missing, fallback to what is configured in /etc/koha/passwd. - If some of the relevant parameters is missing, fail loudly.
Comment on attachment 41424 [details] [review] Patch - remove CREATE USER when koha-create --use-db - if [ "$op" = use ] - then - mysql --defaults-extra-file=/etc/mysql/koha-common.cnf --force <<eof -CREATE USER \`$mysqluser\`@'$mysql_hostname' IDENTIFIED BY '$mysqlpwd'; -CREATE USER \`$mysqluser\`@'%' IDENTIFIED BY '$mysqlpwd'; -GRANT ALL PRIVILEGES ON \`$mysqldb\`.* TO \`$mysqluser\`; -FLUSH PRIVILEGES; -eof - fi #` - This is not enough, as the DB is still being created. Look at my previous comment
(In reply to Tomás Cohen Arazi from comment #2) > > I think the behaviour should be: > > - If the user passes DB parameters (user, pass, hostname, dbname), use them > to configure the instance. This needs more parameters to be added to > koha-create. hostname should default to 'localhost' if ommited. There is currently /etc/mysql/koha-common.cnf used right? Why to change this behavior? If there is nothing defined in here, default client configuration from /etc/mysql/my.cnf is used. Anyway, I am ok with changing this behaviour if the change is consistent. That means, there won't be 10 places where the database connection can be defined. > - If some of the new parameters is missing, fallback to what is configured > in /etc/koha/passwd. Why? That is why passwdfile is used, isn't it? > - If some of the relevant parameters is missing, fail loudly. Agree. ------- To explain more how we use it: first# koha-create --request-db mysql# mysql; CREATE DB ...; GRANT ...; first# koha-create --populate-db second# koha-create --use-db --passwdfile ./file (In reply to Tomás Cohen Arazi from comment #3) > This is not enough, as the DB is still being created. Look at my previous > comment I have just double checked the koha-create script and database is only created when --create is used. It is on line 560 and nowhere else.
Is this ready for sign off?
Created attachment 64552 [details] [review] Bug 14533: remove CREATE USER when koha-create --use-db
Comment on attachment 41424 [details] [review] Patch - remove CREATE USER when koha-create --use-db This was not a 'git bz attach'd patch. Provided one to make testing easier.
Created attachment 64554 [details] [review] Bug 14533: Deal with comment #2
Created attachment 64555 [details] [review] Bug 14533: Deal with comment #2
Created attachment 64712 [details] [review] Bug 14533: remove CREATE USER when koha-create --use-db Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Created attachment 64713 [details] [review] Bug 14533: Deal with comment #2 Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Created attachment 65920 [details] [review] Bug 14533: remove CREATE USER when koha-create --use-db Signed-off-by: Lee Jamison <ldjamison@marywood.edu> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 65921 [details] [review] Bug 14533: Make --use-db display a message if no DB defined Signed-off-by: Lee Jamison <ldjamison@marywood.edu> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 17.11, thanks to everybody involved!
Congratulation Yarik and thanks for your first patch!
Enhancement not pushed to 17.05.x