Uncle Iroh
Uncle Iroh

Reputation: 6045

What is the windows path to the MySQL connections file?

I come from the oracle world where the tnsnames.ora file contain all the sql connection information.

I cannot seem to find the file containing such information for mysql. Could someone with a windows machine tell me where I can find it please.

Upvotes: 1

Views: 4216

Answers (2)

Bill Karwin
Bill Karwin

Reputation: 562300

MySQL doesn't need a connections file analogous to the .tns file. MySQL has nothing like a TNS. Connection parameters typically are configured explicitly in your application.

You can optionally create a file called .my.cnf that contains a user's default parameters for connecting.

See also What is the location of mysql client “.my.cnf” in Windows? that shows how to use mysql --help to find out the location of all the config files.

Most people just configure one set of connection parameters in their .my.cnf file, but you can configure multiple sets of connection parameters under different [client] groups, and invoke MySQL client tools to use the respective connection. There's an excellent blog that describes how to set this up here: http://datacharmer.blogspot.com/2011/03/hidden-options-file-trick.html


Re your updated info:

Sorry, I had to boot up a Windows box and install MySQL Workbench to check where the connection info is stored. I don't normally use Windows.

Right, for MySQL Workbench, the connection data is in for example,
C:\Users\Uncle Iroh\AppData\Roaming\MySQL\Workbench\connections.xml

But you're not expected to edit this by hand, and you'll probably ruin it if you try. It's undocumented, and presumably the format could change if you change versions of MySQL Workbench. You should create or edit connections in the Workbench GUI.

Upvotes: 3

dwjv
dwjv

Reputation: 1227

There is no such thing in MySQL. Check for a config file called my.ini or my.cnf. If MySQL is using a non-default port (not 3306), it will be detailed there. Otherwise, connect using:

mysql -u user -p 

This is an executable (mysql.exe) you'll find in the bin directory of the installation (probably). For example, on my Windows box it's here: C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\mysql.exe

Upvotes: 1

Related Questions