Open weirdan opened 3 years ago
On Debian Buster, using the Debian packaged version:
mycli --version
Version: 1.23.2
One work-around for this error:
mycli
Connecting to socket /var/run/mysqld/mysqld.sock, owned by user mysql
(1698, "Access denied for user 'mysql'@'localhost'")
is to create a ~/.my.cnf
like this:
[client]
user="foo"
password="SOME_LONG_RANDOM_STRING"
socket="/run/mysqld/mysqld.sock"
And a ~/.myclirc
like this:
[alias_dsn]
bar="mysql://foo@localhost/bar"
baz="mysql://foo@localhost/baz"
And then connect to the databases like this:
mycli -d bar
mycli -d baz
However this isn't ideal as running the client without arguments still generates an error:
mycli
Connecting to socket /var/run/mysqld/mysqld.sock, owned by user mysql
(1698, "Access denied for user 'mysql'@'localhost'")
Another option is to add the following to ~/.bash_aliases
:
alias mycli="mycli -u foo"
And source
the file or login again and then mycli
works without an error:
mycli
Connecting to socket /var/run/mysqld/mysqld.sock, owned by user mysql
mysql 10.5.12-MariaDB-0+deb11u1
mycli 1.23.2
Chat: https://gitter.im/dbcli/mycli
Mail: https://groups.google.com/forum/#!forum/mycli-users
Home: http://mycli.net
Thanks to the contributor - spacewander
mysql foo@(none):(none)>
The reason that mycli
defaults to the mysql
user is explains in this pull request.
Version: 1.24.1
Steps to reproduce
Connect via a socket (with a non-default path), e.g.
Expected
mycli
can connectActual
Note that the path to socket specified via cli argument is ignored and default path is used.
Workaround
If I specify the port, it works, even though port makes no sense for socket connections:
Cause
https://github.com/dbcli/mycli/blob/d62eefdc819a11ecdb97d93dd7ad1922d28a3795/mycli/main.py#L420-L428