Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
edited by

I am having a server with Rackspace. I am trying to access the database from the command line of my local machine.

I have tried like below:

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

But it gives the below error:

 ERROR 2003 (HY000):

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

What is the reason for this above error and how could I be able to connect to the remote database? 

1 Answer

0 votes
by (12.7k points)
edited by

In order to straight login 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}

For example

mysql -u root -p'root' \
        -h 127.0.0.1 -P 3306 \
        -D local

There should not be any space after -p as stipulated in the documentation.

Then this would take you to the MySQL console quickly by changing to the specified database.

If you want to learn more about SQL, Check out this SQL Certification by Intellipaat.

Do check out the video below

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 17, 2020 in SQL by Appu (6.1k points)

Browse Categories

...