0

There was an old system on Centos 5.5 which pattern as below:

  • OS:CentOS release 5.5 (Final)
  • Web Server:Apache 2.2.3
  • AP Server:Tomcat 6.0.3.6
  • JDK:1.6.0_37-b06
  • DB:MySQL 5.5.27-1

As customer requires, I have to install duplication of everything(Apache, Tomcat, Mysql, Java) on the same machine without making any changes and effects on their server. I did some tests on a virtual machine and I got problems with mysql. My tests with versions of mysql are 5.5.27 and 5.16.19 with different datadir, port, even my.cnf configuration

[root@localhost ~]# vim /usr/local/src/mysql5.5.27/my.cnf
mysql5.5.27
basedir = /usr/local/src/mysql5.5.27
datadir = /usr/local/src/mysql5.5.27/data
port = 3306
socket = /tmp/mysql5.5.27.sock

[root@localhost ~]# vim /usr/local/src/mysql5.6.19/my.cnf
mysql5.6.19
basedir = /usr/local/src/mysql5.6.19
datadir = /usr/local/src/mysql5.6.19/data
port = 3307
socket = /tmp/mysql5.6.19.sock

Two services are starting OK without errors But the problem is I try login to mysql, I got this error

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Please, if anyone has any experience with multiple instances of mysql? Please help me to understand this circumstances.

※ I want to separate the configuration files of 2 instances of mysql.

alexander.polomodov
  • 1,060
  • 3
  • 10
  • 14
Ruby
  • 1
  • 2
  • curious why 5.7 / 8.0 aren't on your version test environment. If you move beyond an obsolete Centos5.5 you could use multiple concurrent mysql implementations by running them in docker. – danblack Aug 22 '18 at 02:45

1 Answers1

1

For mysql command line you need a my.cnf file in a location read by mysql --help (at the top it lists the config files read.

You'll need a directive like:

  [client]
  socket = /tmp/mysql{version}.sock
danblack
  • 1,179
  • 10
  • 14