[OpenSIPS-Users] opensips-cli database create crashes if username is not opensips

John Quick john.quick at smartvox.co.uk
Wed May 5 14:16:56 EST 2021

I am new to v3 and just started learning how to use opensips-cli.
With the old v2.4 opensipsdbctl utility it was possible to change the
username before creating the database and the dbctl utility would create a
new user in MySQL with the specified name and password, giving them
appropriate privileges for r/w access to the data in the tables.
When I try to do the equivalent in opensips-cli, it creates a new database
called opensips (with no tables), then crashes:

(osipscli-local): database create
Password for admin MySQL user (root):
Traceback (most recent call last):
  File "/usr/lib/python3.7/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'OpenSIPSCLIShell' object has no attribute 'do_database'

I've experimented and confirmed that the 'database create' command works
fine as long as the username is left as default "opensips".
i.e. if this line is present in the opensips-cli.cfg file then it will crash
when I create the database:
  database_url: mysql://myusername:abc123@localhost

..but if it looks like this instead then it works okay:
  database_url: mysql://opensips:abc123@localhost

I tried it with and without the following line, but it made no difference:
  database_name: opensips

I'm using the Debian buster binaries from Nick Altmann's repository. V3.1.1
# opensips-cli -v
OpenSIPS CLI 0.1.0

John Quick
Smartvox Limited

More information about the Users mailing list