0

I have MySQL 8 on Debian 9 vps, and my problem that I can connect to server from php Adminer (web) with any port I've chosen:

localhost:3307, 33650, any port.

And php Adminer showing - MySQL » localhost:33899. And I can manage databases, but this instance is from 3306, which is default. Why such thing is happen? Am I miss something? This question was born due of other question on DBA - https://dba.stackexchange.com/questions/296108/mysql-8-insert-values-into-selected-columns-only

And no other instances of MySQL are running in that case. Even if I run them, I can connect only from command line, not from Adminer web nor from game script side.

noszone
  • 1
  • 2
  • 1
    what is the business related question in here? for me its to broad and an X and Y problem also - update your question to be more precise – djdomi Jul 26 '21 at 10:22

1 Answers1

0

It looks like I probably found an answer.

This is because if you specify "-h localhost" - it will connect you to MySQL socket, and --port will be ignored (no TCP/IP will be used, and hence the --port option has no meaning).

To connect to a different port, simply use an address which is not "localhost", but 127.0.0.1:

Credits to: https://lxadm.com/MySQL:_connecting_to_different_ports_on_localhost

So, I have to take care of 127.0.0.1:my port. Probably requires binding, etc.

So, finally it's working now, the lesson I've learned that localhost isn't the same as 127.0.0.1. I just made edit to *.cnf:

bind-address=127.0.0.1
noszone
  • 1
  • 2