Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSN with schema without user fails #1171

Open
mlopezgva opened this issue Aug 20, 2024 · 0 comments
Open

DSN with schema without user fails #1171

mlopezgva opened this issue Aug 20, 2024 · 0 comments

Comments

@mlopezgva
Copy link

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. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant