wiki:mysql_command_line_access

Mysql Command Line Access

In order to get command line access to mysql servers, each database must have a unique .my.cnf file specifying the database, username and password.

.my.cnf

A .my.cnf file should have the following structure:

[client]
user=USERNAME
password=PASSWORD
[mysql]
database=DATABASENAME

Where USERNAME = the mysql_db user, PASSWORD = the mysql db_user password, and DATABASENAME = the mysql_db name.

Using multiple databases

Each individual database should contain its own .my.cnf file. You can access multiple databases by naming database specific files with .my.db_name.cnf and then issuing the mysql command:

mysql --defaults-file=.my.db_name.cnf
Last modified 9 years ago Last modified on Dec 21, 2010, 1:45:42 PM