remote access to mysql db

 
Post new topic   Reply to topic    34SP.com Forum Index // Database Support
View previous topic :: View next topic  
Author Message
N_i_c_k
34SP Newbie
34SP Newbie


Joined: 07 Oct 2008
Posts: 2

PostPosted: Fri Apr 16, 2010 11:08 pm    Post subject: remote access to mysql db Reply with quote
Hi,

I'm new to mysql so pls forgive simple query...

I've set up a new db on my 34sp domain and, have mysql running on my local machine. I'm now trying to connect to the db on my domain from the command line but having no joy. According to instructions from 34sp, I should be able to connect from command line using this:

mysql -h MYDOMAIN -u USER -p (where MYDOMAIN is your domain name and USER is your username)

But, like I say no joy.

I've typed it in with my details at the mysql> prompt but I just get an error. (error 1064) Tried various combinations but still no joy.

Anyone there that can help?

Many thanks
Back to top
View user's profile Send private message
philr
Super Member
Super Member


Joined: 05 Nov 2003
Posts: 990
Location: Exeter

PostPosted: Sun Apr 18, 2010 9:47 am    Post subject: Reply with quote
It looks like you're typing these command line instructions into the mysql application. That won't work. You need to start with a Unix command prompt. Removing the spaces after the -h and -u switches might help too, if you're still having problems.

To connect to the database db_name as user db_user on domain example.com, you should type this in at your Unix prompt:

mysql -hexample.com --ssl -udb_user -p db_name

The --ssl switch will enable a secure connection if one is available.
_________________
Phil Ronan
フィリップ・ローナン
Back to top
View user's profile Send private message Visit poster's website
N_i_c_k
34SP Newbie
34SP Newbie


Joined: 07 Oct 2008
Posts: 2

PostPosted: Mon Apr 19, 2010 8:29 pm    Post subject: Reply with quote
Hi, many thanks for the advice (I'm using terminal in mac BTW).

So, not having started mysql locally on my machine, I typed in

mysql -hMyDomainName --ssl -uDb_user -p Db_name

directly at the $ prompt

and I get this error message:

mysql: command not found

It'd sure be useful to edit the mysql db directly in terminal but for now, I've managed to do it in the phpmyadmin SQL window.

Thanks...
Back to top
View user's profile Send private message
philr
Super Member
Super Member


Joined: 05 Nov 2003
Posts: 990
Location: Exeter

PostPosted: Tue Apr 20, 2010 1:38 pm    Post subject: Reply with quote
In that case Darwin doesn't know where your MySQL application is. Try replacing mysql with /usr/local/mysql/bin/mysql and see if that works.

You can avoid this by adding the mysql/bin directory to your $PATH shell variable. Assuming the path I gave you above is correct, you can do this by typing the following at the command line prompt:
Code:
echo -e "\nexport PATH=/usr/local/mysql/bin:\$PATH\n" >> ~/.profile


Or you could edit ~/.profile directly. It's hidden from the Finder because its name starts with a period, but TextWrangler will open it no problem. There is probably already a line in there that adds things to the PATH variable. You just need to add "/usr/local/mysql/bin" to the (colon-separated) list.
_________________
Phil Ronan
フィリップ・ローナン
Back to top
View user's profile Send private message Visit poster's website
Post new topic   Reply to topic    34SP.com Forum Index // Database Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Powered by phpBB © 2001, 2002 phpBB Group