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 here - 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.

1
  • as i already explained it is dangerpous to have a database open from the internet, all tools like phpmyadmin or similiar devices usaully only work on localhost, but can be configured also to connect to other machines, but because the security issues described, they don't. dba is the worng place for your request serverfault or even a ubuntu forum could be better fit
    – nbk
    Jul 25, 2021 at 14:56

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.