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.

  • 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


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

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

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

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


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.