When attempting to access a remote MySQL database from a local machine command line, you may encounter the error "Can't connect to MySQL server on 'my.application.com' (10061)." This error often occurs when your connection parameters are incorrect.
The correct command syntax for connecting to a remote MySQL database is:
mysql -u {username} -p'{password}' \ -h {remote server ip or name} -P {port} \ -D {DB name}
Ensure that you provide the correct:
For example:
mysql -u root -p'root' \ -h 127.0.0.1 -P 3306 \ -D local
This command will connect you to the "local" database on the remote server "127.0.0.1" using the "root" user and the "root" password, assuming the port 3306 is used.
If you encounter any further connection issues, ensure that:
The above is the detailed content of How to Troubleshoot 'Can't Connect to MySQL Server' Errors When Connecting Remotely via Command Line? .. For more information, please follow other related articles on the PHP Chinese website!