0

I have MySQL installed from ports, running and listening on port 3306. On the same server I have Percona Server compiled from sources, running and listening on port 3307.

Here are the process list for percona & mysql:

#mysql 
processes bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/mysql.pid
/usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --plugin-dir=/usr/local/lib/mysql/plugin --user=mysql --log-error=/var/db/mysql/mysql.err --pid-file=/var/db/mysql/mysql.pid

#percona processes
/bin/sh /usr/local/percona/bin/mysqld_safe --defaults-extra-file=/home/percona/my.cnf --user=percona --datadir=/home/percona --pid-file=/home/percona/mysql.pid
/usr/local/percona/bin/mysqld --defaults-extra-file=/home/percona/my.cnf --basedir=/usr/local/percona --datadir=/home/percona --plugin-dir=/usr/local/percona/lib/plugin --user=percona --log-error=/home/percona/mysql-error.log --open-files-limit=65535 --pid-file=/home/percona/mysql.pid --socket=/tmp/percona.sock --port=3307

As you can see percona is running with --socket=/tmp/percona.sock --port=3307.

When I'm trying to connect Percona from localhost, I'm facing strange situation.

mysql -S /tmp/percona.sock -uroot -p # ok, I'm connected to Percona
mysql -P 3307 -uroot -p              # NO! I'm connected to MySQL

BUT, when I'm trying to connect to 3307 from another server - I'm successfully connected to Percona (not MySQL)

#on another server
mysql -P 3307 -h somehost -u root -p # ok, I'm connected to Percona

Why? Why connection to 3307 from localhost leads to regular MySQL. But connection to 3307 from another host leads to Percona Server?

Kirzilla
  • 563
  • 3
  • 9
  • 21

1 Answers1

1

mysql -P 3307 -uroot -p # NO! I'm connected to MySQL, - host by default is localhost. If so, a client connects over unix socket, not over TCP. Thus -P option doesn't make sense. However if you connect like this mysql -P 3307 -uroot -p -h 127.0.0.1 it will force the client use TCP and you'll get to Percona.

akuzminsky
  • 738
  • 4
  • 9