0

Is there a way to use environment variables in my.cnf? Ideally, I'd like to do something like

[client] user = $MYSQL_USER password = $MYSQL_PASSWORD host = db 

But, with the configuration above, when I try to connect to MySQL, I get

ERROR 1045 (28000): Access denied for user '$MYSQL_USER'@'188.1.1.5' (using password: YES)

2 Answers 2

0

This is not possible. MySQL does not support variables in the configuration file.

If you want to ease deployment you should look into configuration management.

1
  • Thank you for the reply. Commented Jul 18, 2022 at 9:42
0

See mysql_config_editor as a convenient way to both establish your credentials and make them reasonably secure.

Since it is a one-time setup, you don't even need the $variables after that.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.