Access MySQL Remote Databases from Command Line

I have a server with Rackspace. I want to access the database from the command line of the local machine.

I have tried:

mysql -u username -h my.application.com -ppassword

But it gave an error:

< p>ERROR 2003 (HY000):

Can’t connect to MySQL server on’my.application.com’ (10061)

The reason for this error is What? How to connect to a remote database?

To log in directly to the remote mysql console, use the following command:

mysql -u {username} -p'{password}' \
-h {remote server ip or name} -P {port} \
-D {DB name}

It will directly enter the mysql console by switching to the mentioned database.

31-07-2019 – Edit syntax

< /p>

I have a server with Rackspace. I want to access the database from the command line of the local machine.

I have tried:

< pre>mysql -u username -h my.application.com -ppassword

But it gives an error:

ERROR 2003 ( HY000):

Can’t connect to MySQL server on’my.application.com’ (10061)

What is the cause of this error? How to connect to a remote database?

To log in directly to the remote mysql console, use the following command:

mysql -u {username} -p'{password}' \
-h {remote server ip or name} -P {port} \
-D {DB name}

It You will directly enter the mysql console by switching to the mentioned database.

31-07-2019 – Edit syntax

Leave a Comment

Your email address will not be published.