accessing mysql server remotely
tevans.uk at googlemail.com
Tue Jul 10 13:50:32 UTC 2007
On Tue, 2007-07-10 at 12:15 +0000, Duane Hill wrote:
> On Tue, 10 Jul 2007 at 12:01 -0000, d.hill at yournetplus.com confabulated:
> > On Mon, 9 Jul 2007 at 23:33 -0400, fbsd at a1poweruser.com confabulated:
> >> Just a general question about mysql remote access.
> >> Is it possible to login to my remote mysql server and create a
> >> new db & table using a file on the local system which contains
> >> the definition statements?
> > Sure. As long as the account name used to login to MySQL has login access
> > from the remote location.
> > mysql -host=ip_or_hostname -user=username -password=password dbname <
> > statements.sql
> My bad. The command line parameters should have two hyphens:
> mysql --host=ip_or_hostname --user=username --password=password dbname < statements.sql
Whilst this syntax will work fine, it requires that the mysql server
allow remote logins - well I already have a nice cryptographically
secure way of allowing remote access, it's called SSH:
cat statements.sql |\
ssh -C user at hostname 'mysql -u<user> -p<pass> <dbname>'
The main benefit of this is that my mysql server now only needs to run
on localhost, and so cannot be touched by any external user. For an
interactive mysql prompt, you'd need either to open up mysql, or forward
ssh -C -L13306:localhost:3306 user at hostname
mysql -u<user> -p<pass> -hlocalhost -P13306 <dbname>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070710/8bd00045/attachment.pgp
More information about the freebsd-questions