2

I am running MySQL 5.5 on Ubuntu 14.04. I can open and work with local databases using mysql in the terminal. I can also run phpMyAdmin and access the database on db4free.net on the browser. However i would like to know how to achieve the same (access the db4free DB) from the terminal using mysql command.

Thanks in advance.

2 Answers 2

3

Use this command

mysql -u <username> -p -h db4free.net
2
  • What if I am behind a proxy. Is there a way to let mysql use proxy? Mar 26, 2015 at 8:09
  • @blumonkey: depends on the proxy: most: yes, some: no
    – Fabby
    Aug 10, 2015 at 14:32
0

Assuming that the server allows remote access, from Mysql.com: MySQL :: MySQL 5.0 Reference Manual :: 4.2.2 Connecting to the MySQL Server, run this command:

mysql --host=<mysql_server_ip_address> --user=<mysql_username> --password <mysql_database_name>

If the server doesn't use the default MySQL port (3306), append the --port argument to the command:

mysql --host=<mysql_server_ip_address> --port=<mysql_server_port> --user=<mysql_username> --password <mysql_database_name>

Then enter your password and press Enter.

On a side note, you could even append the password directly to the command by using --password=<mysql_password> instead of --password, altough users on your system would be able to see it by running ps auxw, so see for yourself which method suits the most.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .