Score:0

MySQL 8 - connecting to server with different port

cn flag

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.

djdomi avatar
za flag
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
Score:0
cn flag

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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.