### Description
When running kamdbctl for the first time with `DBENGINE=MYSQL` , it will try to create the same user twice which causes a failure. Because the user is already there, the create fails and the install script fails
As a new user this is very confusing as it leads you to believe that you're blocked. However, if you enable prompt and run it twice and then skip adding access the second time, you can continue.
``` root@924dfe238957:/# /usr/sbin/kamdbctl create Create the database 'kamailio'? (y/n): y -e \E[37;33mINFO: creating database kamailio ... Create database users with access privileges? (y/n): y -e \E[37;33mINFO: granting privileges to database kamailio ... ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'kamailio'@'mariadb' ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'kamailioro'@'mariadb' ```
### Troubleshooting
If you modify `./usr/lib/x86_64-linux-gnu/kamailio/kamctl/kamdbctl.mysql` to echo the command instead, then you get the following debugging info.
``` root@924dfe238957:/# /usr/sbin/kamdbctl create Create the database 'kamailio'? (y/n): y -e \E[37;33mINFO: creating database kamailio ... mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE DATABASE kamailio CHARACTER SET latin1; Create database users with access privileges? (y/n): y -e \E[37;33mINFO: granting privileges to database kamailio ... mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE USER 'kamailio'@'mariadb' IDENTIFIED BY 'kamailiorw'; GRANT ALL PRIVILEGES ON kamailio.* TO 'kamailio'@'mariadb'; mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE USER 'kamailioro'@'mariadb' IDENTIFIED BY 'kamailioro'; GRANT SELECT ON kamailio.* TO 'kamailioro'@'mariadb'; mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE USER 'kamailio'@'localhost' IDENTIFIED BY 'kamailiorw'; GRANT ALL PRIVILEGES ON kamailio.* TO 'kamailio'@'localhost'; mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE USER 'kamailioro'@'localhost' IDENTIFIED BY 'kamailioro'; GRANT SELECT ON kamailio.* TO 'kamailioro'@'localhost'; mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE USER 'kamailio'@'mariadb' IDENTIFIED BY 'kamailiorw'; GRANT ALL PRIVILEGES ON kamailio.* TO 'kamailio'@'mariadb'; mysql -h mariadb -P 3306 -uroot -ppasswd -e CREATE USER 'kamailioro'@'mariadb' IDENTIFIED BY 'kamailioro'; GRANT SELECT ON kamailio.* TO 'kamailioro'@'mariadb'; ```
As you can see ` 'kamailioro'@'mariadb'` and ` 'kamailioro'@'mariadb'` are added twice which creates a 1396 error.
#### Reproduction
```
```
Thanks for the report. Surely the DB scripts can be improved in several areas, and also made more robust in case they are executed several times. If you have some improvement ideas, please create a pull request that we can review it and also integrate into the git repository.
Closed #3280 as completed.
I tried and all works fine. Also, a few weeks ago I was in a team of about 10 persons that each run the command for kamailio 5.6.x on Debian 11 and nobody reported similar issue. It can be a matter of kamctlrc options, but discussing about configuring Kamailio or its tools has to be done on sr-users@lists.kamailio.org mailing list. If it proves to be actually a problem, this can be reopened.
or use mysql> drop user 'kamailioro'@'localhost'; mysql> drop user 'kamailio'@'localhost';