### 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
```
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3280
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3280(a)github.com>