ERROR Connecting to MySQL database using third-party programs


#1

I could use a little guidance, please! I have been connecting to my database using phpMyAdmin, which I know is not secure, so thought I would try a more secure method. I have read the wiki and have done the following:
[list]
[]added my ip to allowable hosts
[
]granted my user ssh access
[]installed putty (on Debian 6.0.6) and entered info as instructed
[
]installed MySQL Administrator and entered info as instructed
[/list]
I can log into my shell account through putty with no problem. When I try to connect to my database using MySQL Administrator, I get the following error message:

Could not connect to host ‘localhost’.
MySQL Error Nr. 2002
Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

I have tried entering 3307 in the source port and MySQL Administrator port field, but still get the same error.

Could anyone advise on how to connect? I really do not want my username/password to be exposed in plain text using phpMyAdmin. Thanks in advance.


#2

The error message you’re getting indicates that you have not set the MySQL hostname correctly.


#3

Hello, Andrew. Thank you for your reply.

In the destination field in putty, I entered mysql.mydomain.com:3306. In the host name field I entered mywebserver.dreamhost.com. Should I use mymysqlserver.dreamhost.com? When I tried it, I only get a blank screen in putty and no password request. The instructions in the wiki say to enter your mysql database address as yourdbdomain.yourdomain.com:3066 in the destination field and your shell account address in the host name field. I assumed my shell account address is mywebserver.dreamhost.com.

In MySQL Administrator I entered localhost for the server host as instructed.

Please, can you tell me what am I doing wrong? I am confused. Thank you for your help.


#4

Just to eliminate possible connection issues, you might try a different application such as MySQL workbench, which has a very straightforward connection setting for adding a connection. or, You can also connect via SSH command line.

If you are able to connect with MySQL workbench or some other way, then you know that you just misconfigured putty; however, if you cannot get either to connect then double-check your permissions on your.


#5

Well, on a hunch I tried entering 127.0.0.1 in place of localhost under Server Host in MySQL Administrator and was able to connect. Does anyone know any reason why doing it this way would be an issue?

sierracircle, thanks for the suggestion.


#6

The MySQL tool you are using infers some special behavior (connecting to a local UNIX socket) when the hostname is literally set to “localhost”. Your hunch was absolutely correct, and you should be fine now.

Sorry about the confusing earlier response — I didn’t quite understand what you were doing at first.


#7

Thanks, Andrew. I appreciate your help. I only choose the “MySQL Administrator” tool because instructions for setting it up were included in the wiki. This is all totally new to me, so I am learning as I go.

Ironically, I just noticed, the link in the wiki to MySQL Administrator redirects to MySQL Workbench, so I am guessing MySQL Administrator is outdated and no longer supported. I had installed MySQL Administrator through my Debian package manager, so I didn’t realize there was a connection between the two tools.


#8

Now that I have the whole putty/third party tools thing figured out, could I get a little noob advice? To anyone who has a spare minute…what do you use or recommend as the easiest secure way to connect to your database? Basically all I will be doing is imports/exports, but I am not comfortable not having a GUI. I have tried the putty/MySQL Administrator combo (which was simple enough once a got it figured out), but I didn’t see an import/export option. I also tried MySQL Workbench, which did have the import/export option but I was totally overwhelmed by all the setting up. (That said, I’m not opposed to learning something new, if it’s really the way to go.) And I saw another thread which discussed using putty/phpmyadmin, which I think I would be comfortable with since I have been using phpmyadmin. Are there any pros/cons you could share? I’m leaning toward putty/phpmyadmin, but is it really a secure method? And would database size be an issue for any of them? I would appreciate any comments. Thanks in advance.