----- Original Message -----
> From: "Thufir" <hawat.thu...@gmail.com>
> Subject: Re: ssh basics
> 
> I was being serious, I always appreciate a reply.  I know it was worded
> oddly, but, yes, just take it at face value, please.

Oh, I didn't see anything wrong with wording, but text doesn't convey a lot of 
inflexions :-p


> I read multiple suggestions to connect with that approach, the -L switch,
> none of the blogs/etc I saw explained why.  I suppose they assume that
> you know why already so don't say.  It's possible I overlooked the
> context, but I don't think so.

-L is local port forwarding; so -L localhost:3306:localhost:3306 will forward 
localhost:3306 on your machine (first two parameters) to localhost:3306 on the 
remote machine (second two parameters). Remote port forwarding with -R works 
the other way round.


> In and of itself, I'm fine with ssh into the host and then using the mysql
> console.  Since I'm not running scripts, it's moot whether the connection
> is through mysql directly, if that's the correct terminology, or just
> regular ssh.

>From a security point of view it isn't moot, as the MySQL protocol is 
>unencrypted unless you've set up SSL - but that's probably out of your scope 
>atm.


> I'm interested in how ssh is used by MySQL.  While I have a pdf book on
> ssh, I don't, at the moment, have the time to just sit down and read it
> cover to cover.

SSH is not used by MySQL at all :-) SSH is a way of connecting to a remote 
machine. MySQL is a database. You can use SSH to do things with the database, 
but they're not intrinsically related.


> In the longer term, I'm considering whether or not to backup a small db,
> with cron, master/slave, or replicate it -- or something else.  I need to
> do some reading on that.  I've always done fine with just using mysqldump,
> but will probably need some additional tools to use.

Replication is not backup, it's high availability. Backup entails having 
multiple versions; or at the very least one copy that is not automatically 
updated with users errors from the primary system :-p


> Yes, I'm still figuring out the mechanics of ssh.  It was more of a ssh
> question than a MySQL question, fair enough, pardon about that, but was
> within the specific context of MySQL.

All in all, you've done the opposite of what I asked - you've told me what you 
know and tried, but not what you were trying to figure out with your original 
question :-p

Under the assumption that you wanted to use ssh to "magically" have a mysql 
prompt appear on your console:
* [ssh -t user@host mysql] will log in to your machine and start the mysql 
client. The -t tells SSH to allocate a pseudoterminal even though you specified 
a command to run.
* SSH keys (using ssh-agent or passwordless keys) will authenticate you against 
the remote OS, but NOT against the mysql auth system. You could use a .my.cnf 
file in your remote homedir for that; but that will have to hold the password 
in plaintext. Not particularly secure.
* [ssh -L 3307:localhost:3306 user@host] (3307 because you apparently had a 
local mysql on 3306 already) will forward as above, so you can do [mysql 
-hlocalhost -p3307] /on another terminal/ to connect to the remote mysql.

Personally I find the last one only useful if I want to use other things than 
the commandline on remote servers; but ymmv :-)

-- 
Unhappiness is discouraged and will be corrected with kitten pictures.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to