What is the solution if I don’t want to give password in
command line (i.e mysql -uroot -p ) OR don’t want to store
password in files(in .my.cnf) and still can login into
MySQL/MariaDB without password ? I was also bit curious to know
but finally I found very easy solution called
“unix_socket plugin” provided by
MariaDB.
This plugin allows to use operating system user
credentials while connecting to MariaDB via Unix socket.
When we try to connect with OS user, it will retrieve uid of the
process which has connected to the socket and allow it to connect
to MariaDB with the same user.
You can simply install that plugin with command,
MariaDB [(none)]> INSTALL PLUGIN unix_socket SONAME 'auth_socket';
Query OK, 0 rows affected (0.02 sec)
After, then you need to identify the user which you want to use
to login into MariaDB. Like for me,
…
[Read more]