<p></p>
<h3 dir="auto">Description</h3>
<p dir="auto">When running kamdbctl for the first time with <code class="notranslate">DBENGINE=MYSQL</code> , 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</p>
<p dir="auto">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.</p>
<pre class="notranslate"><code class="notranslate">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'
</code></pre>
<h3 dir="auto">Troubleshooting</h3>
<p dir="auto">If you modify <code class="notranslate">./usr/lib/x86_64-linux-gnu/kamailio/kamctl/kamdbctl.mysql</code> to echo the command instead, then you get the following debugging info.</p>
<pre class="notranslate"><code class="notranslate">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';
</code></pre>
<p dir="auto">As you can see <code class="notranslate"> 'kamailioro'@'mariadb'</code> and <code class="notranslate"> 'kamailioro'@'mariadb'</code> are added twice which creates a 1396 error.</p>
<h4 dir="auto">Reproduction</h4>
<pre class="notranslate"><code class="notranslate">

</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/3280">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPIW6IWL33HCKVJXH3WIQMVFANCNFSM6AAAAAASBPSNUQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZMUML6X2GOHS2TJ6XLWIQMVFA5CNFSM6AAAAAASBPSNUSWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHFM5MBXA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/issues/3280</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/3280",
"url": "https://github.com/kamailio/kamailio/issues/3280",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>