| 1 | [[PageOutline]] |
| 2 | = Mysql Command Line Access = |
| 3 | |
| 4 | 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. |
| 5 | |
| 6 | == .my.cnf == |
| 7 | |
| 8 | A .my.cnf file should have the following structure: |
| 9 | |
| 10 | {{{ |
| 11 | [client] |
| 12 | user=USERNAME |
| 13 | password=PASSWORD |
| 14 | [mysql] |
| 15 | database=DATABASENAME |
| 16 | }}} |
| 17 | |
| 18 | Where USERNAME = the mysql_db user, PASSWORD = the mysql db_user password, and DATABASENAME = the mysql_db name. |
| 19 | |
| 20 | == Using multiple databases == |
| 21 | |
| 22 | 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: |
| 23 | |
| 24 | {{{ |
| 25 | mysql --defaults-file=.my.db_name.cnf |
| 26 | }}} |
| 27 | |