Skip to content

DSN with schema without user fails #1171

@mlopezgva

Description

@mlopezgva

Hi.

I have been trying to configure mycli to connect with several remotes through a tunnel. It seemed to work... until I "moved" the connection parameters to a DSN. If I call the DSN with an schema (--database test) but without a username, it fails. At first I thought it was related to the use of the --ssh arguments, but it happens locally, too:

[alias_dsn]
dcor     = mysql://root:root@docker_databases.local/

This database has some schemas in it (like 'test', 'work' and the internals, of course).

If I execute:

❯ mycli -d dcor -u root -D work
MariaDB 10.5.16
mycli 1.27.2
Home: http://mycli.net
Bug tracker: https://github.com/dbcli/mycli/issues
Thanks to the contributor - Johannes Hoff
root@docker_databases.local:work> \q
Goodbye!

But, since the username (along with the password) is defined in the DSN, and it's a bundle of 18 servers with their user and password each, my intention is to connect and "open" the database with the schema I want to. So, using the DSN and the database parameters should be enough:

❯ mycli -d dcor -D work
Could not find the specified DSN in the config file. Please check the "[alias_dsn]" section in your myclirc.

But it's not. It's clear it gathers the password from the DSN line, since using the -u root logs in directly,without prompting for the password. But if I do not use it, it fails.

This presents me a problem, because I'll have to pass the username if I want to log in directly to the schema I want to use (something I can script to make it shorter)... Or execute a use <schema> each time I log in.

Thank you for this piece of software, BTW. 😃

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions