I wish to modify data on my website database and thought I could do it from the command line but it keeps failing. For example:-
website is myweb.co.uk database is mydb port 22
mysql -u myweb -hmyweb.mysql -P22 -Dmydb
Presumably, I just need to get these three terms right and it should work
First of all, port 22 is used for ssh, not mysql. In addition, its not common to run mysql visible on the internet.
But, if you do have ssh access, you can work around this, by tunneling mysql trough ssh.
In one terminal, run
where example.com is the remote ssh server. This creates a tunnel, between port 3306 locally, and on the remote end. This is encrypted and transported via ssh, so any secrets (passwords and queries) are encrypted while transported over the internet.
In another terminal, you will be able to run
--protocol=TCP
is required, as by default mysql will connect to the socket connection on localhost, but this is unavailable, as mysql is not running locally. This connects to the ssh-tunnel set up previously.