Does MemSQL support user passwords in a configuration file?


#1

MySQL supports storing user passwords in a ~/.my.cnf file (https://dev.mysql.com/doc/refman/8.0/en/password-security-user.html).

Does MemSQL support similar functionality and if so can you point me to the documentation. I searched but did not find anything.


#2

Yes, this option works with MemSQL. This is an option in the MySQL client, so it works exactly as described in the MySQL client documentation you linked to.


#3

I need some help then as it isn’t working for me.

I have created a /root/.my.cnf file with 0600 permissions and contents:

[root@ip-10-something ~]# cat .my.cnf
[client]
password=SuperSecret

However, when as the root user I get:

[root@ip-10-something ~]# memsql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

If I supply my password with the -p flag it works as usual. Any advice on what I’m doing wrong?


#4

Hmm, that worked for me, not sure why it isn’t working in your case. Perhaps try explicitly pointing to the .my.cnf file with the --defaults-file option.


#5
[root@ip-10-something ~]# memsql -u root --defaults-file ~/.my.cnf
memsql-client: [ERROR] unknown option '--defaults-file'

Any ideas what could be going on or what else I need to check?

[root@ip-10-something ~]# memsql --version
/usr/lib/memsql-client/memsql-client  Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using  EditLine wrapper

#6

Ah, I see what the issue is. The memsql client package is a wrapper around the mysql client, and effectively uses the --no-defaults option. We are currently looking into this issue with specifying client configuration.

For now, I think the easiest solution is to install the mysql client and use that directly.


#7

Oh, you can also run the memsql-client binary directly instead of memsql (memsql runs memsql-client with a few default parameters). Something like:

/usr/lib/memsql-client/memsql-client --plugin-dir="/usr/lib/memsql-client/plugin" --protocol=tcp --prompt="memsql> " -u root -h 127.0.0.1 -P 3306

And you can create an alias for that of course.


#8

I installed the mysql57 client package and all is working fine. Thanks Jack!