Is it possible to create different mysql configurations (mysql.cnf files) for specific linux user?
I want to come up with a solution so current user (linux, already authenticated) can have access to mysql by default without having to use -u and -p arguments. Each linux users would already have their mysql user set up with proper permissions on their databases.
Examples of configuration files I would like to set up. By default, the first mysql conf (default.mysql.conf) would be used but if one of the 3 users; root, www-data or bob are logged in, I would like mysql to use the corresponding configuration file. Is it possible to make this work?
... [client] # nothing, must authenticate with -u and -p arguments ...
... [client] user = mysqlroot password = AbCdEfG1234pwd ...
... [client] user = mysqlwwwdata password = AbCdEfG1234wwwpwd ...
... [client] user = mysqlbob password = AbCdEfG1234bobpwd ...
The file you want to create is
$HOME/.my.cnf, in each user’s home directory, from which the MySQL client will read configuration directives for each corresponding user.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.