Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is what I'm doing:

mysql --host=localhost --port=9999 mysql -u root -p --execute="show tables;"

The command works (connecting to port 3306) no matter what I provide in --port argument. I have two mysql servers running on one machine, and want to connect to the second one by explicitly providing its port number. What's going on? Why mysql ignores this parameter?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

When localhost parameter given, MySQL uses sockets. Use 127.0.0.1 instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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