MySQL requires the configuration of the MySQL server process, mysqld , and its several client processes such as the mysql command-line utility. MySQL exposes its Unix roots in how you configure it. Specifically, you configure it using a combination of command-line options, configuration files, and environment variables. Just about any configurable item can be managed using these three mechanisms.
Because you can define options in multiple ways, MySQL has a built-in order of preference that defines how it resolves conflicts:
Environment variable options
In other words, if you have three different values specified for the password option, MySQL client tools will use the one you specified on the command line.
The simplest, most common way to handle your MySQL options is with a configuration file. A configuration file enables you to stick all your options in a file so you do not have to specify them each time you run a command or log into a machine.