Multiple MySQL instances - clean MySQL hostname required

Hi guys,

I have 2 instances of MySQL configured in my linode (one for dev and another for release). MySQL connection string for my dev MySQL instance is mysql:unix_socket=/var/run/mysqld/mysqlddev.sock;dbname= whereas my rel instance simply connects with localhost as my hostname.

Ideally what I want is to have developer friendly connection string for both mysql instances. something like

mysql:host=dev-mysql.mydomainname.com; //for dev instance

mysql:host=rel-mysql.mydomain.com; //for rel instance.

Can anyone help one how I can configure these settings?

SenG

1 Reply

Assuming this is for local connections only, you can configure your mysql instances to bind to different IP addresses in my.cnf

bind-address=127.0.1.1

and

bind-address=127.0.1.2

Map these to hostnames in your /etc/hosts file

127.0.1.1 dev.mysql

127.0.1.2 rel.mysql

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct