Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2007 14:50:26 +0100
From:      Tom Evans <tevans.uk@googlemail.com>
To:        Duane Hill <d.hill@yournetplus.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: accessing mysql server remotely
Message-ID:  <1184075426.1228.12.camel@localhost>
In-Reply-To: <20070710121422.S27505@duane.dbq.yournetplus.com>
References:  <NBECLJEKGLBKHHFFANMBOELGCEAA.fbsd@a1poweruser.com> <20070710115624.K27424@duane.dbq.yournetplus.com> <20070710121422.S27505@duane.dbq.yournetplus.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-tBT01zXFNefDjo0w14Gi
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2007-07-10 at 12:15 +0000, Duane Hill wrote:
> On Tue, 10 Jul 2007 at 12:01 -0000, d.hill@yournetplus.com confabulated:
>=20
> > On Mon, 9 Jul 2007 at 23:33 -0400, fbsd@a1poweruser.com confabulated:
> >
> >> Just a general question about mysql remote access.
> >>=20
> >> 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 acce=
ss=20
> > from the remote location.
> >
> > mysql -host=3Dip_or_hostname -user=3Dusername -password=3Dpassword dbna=
me <=20
> > statements.sql
>=20
> My bad. The command line parameters should have two hyphens:
>=20
> mysql --host=3Dip_or_hostname --user=3Dusername --password=3Dpassword dbn=
ame < statements.sql
>=20


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 |\=20
   ssh -C user@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
a port:

ssh -C -L13306:localhost:3306 user@hostname
mysql -u<user> -p<pass> -hlocalhost -P13306 <dbname>

--=-tBT01zXFNefDjo0w14Gi
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQBGk46ilcRvFfyds/cRAsgrAJ0Xld2Tyam5Cu23rZyclaOSoujEiQCgkv/C
vUupMrJHvtJP1EUqwmbctsU=
=pqjh
-----END PGP SIGNATURE-----

--=-tBT01zXFNefDjo0w14Gi--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1184075426.1228.12.camel>