Web Hosting Talk







View Full Version : Remote mySQL database connection problem


LotusLand
07-24-2004, 10:32 AM
Hi folks

I have a Unix reseller account with Donhost and have a few mySQL databases running fine using their mySQL Admin web interface.Trouble is, their interface doesn't have the option of importing data and I need to migrate several large existing databases.

Obviously there's loads of mySQL tools out there but my problem is that Donhost insist on different passwords for the database and the ftp account. The software I've tried doesn't allow me to enter independent passwords so I'm stumped!

Is there a way around this?

Any advice or info much appreciated...

LL

sprintserve
07-24-2004, 10:39 AM
Try www.mysqlfront.de

LotusLand
07-24-2004, 11:05 AM
Hi, just tried your software suggestion, but it doesn't allow me to specify:

ftp server
ftp username
ftp password
mySQL host: localhost
database name
mySQL username
mySQL password

So, still looking for a solution...

LL

sprintserve
07-24-2004, 11:36 AM
I am not sure I understood your original post then. What do you need FTP details for?

LotusLand
07-24-2004, 11:51 AM
What I was trying to get across was that my web host provider (I have a reseller account with virtual sites etc) allows a limited web-based admin panel and requires us to use localhost as the mySQL server host name. Obviously, I'm connecting remotely so it takes the details from the ftp account. However, it requires a different password to access the database from that of the ftp account.

Is that clearer?!

HTH

LL

andreyka
07-24-2004, 12:04 PM
If you have shell access ssh or run command form panel, then download mysqldum of database via ftp and run command mysql dbname < download.db

LotusLand
07-24-2004, 12:48 PM
Originally posted by andreyka
If you have shell access ssh or run command form panel, then download mysqldum of database via ftp and run command mysql dbname < download.db

Thanks for the replies so far.

Unfortunately I don't have shell access or the ability to run commands, although I can enter SQL queries and click on a Run mySQL button from a web page.

HTH

LL

wheimeng
07-24-2004, 09:38 PM
Hm, logging into FTP would not be able to extract the data as well since your MySQL is not located in your home dir.

There are programs out there that are able to connect to port 3306 (MySQL) directly and extract the data.

wheimeng
07-24-2004, 09:40 PM
BTW, please remember to add your IP in MySQL allowable host so that you could login. Default, it is set as localhost, just add your IP to it.

Just in case you don't know what your IP is, check http://whatismyip.com

sprintserve
07-25-2004, 01:42 AM
Originally posted by LotusLand
What I was trying to get across was that my web host provider (I have a reseller account with virtual sites etc) allows a limited web-based admin panel and requires us to use localhost as the mySQL server host name. Obviously, I'm connecting remotely so it takes the details from the ftp account. However, it requires a different password to access the database from that of the ftp account.

Is that clearer?!

HTH

LL

Well use the program I pasted, but set Port 3306. Instead of localhost, use your website URL or IP address as the host.

You will need to check if the control panel allow you to add remote hosts ie the place or hostname where you are connecting from. IF it doesn't you are still out of luck. It also depends on whether your hosts allow remote connections. Some places simply block the port from remote access as well.

Why don't you just ask your current host for help? They will know best what settings they have.

LotusLand
07-25-2004, 01:59 AM
Originally posted by sprintserve
Well use the program I pasted, but set Port 3306. Instead of localhost, use your website URL or IP address as the host.

You will need to check if the control panel allow you to add remote hosts ie the place or hostname where you are connecting from. IF it doesn't you are still out of luck. It also depends on whether your hosts allow remote connections. Some places simply block the port from remote access as well.

Why don't you just ask your current host for help? They will know best what settings they have.

Thanks again for the flurry of suggestions folks!

Yes, I've tried all the above, without success. Of course, I did email my host about these but never got replies :-(

It seems I can only connect via localhost, taking information from the ftp details to get the initial ip address etc.

One chink of light though - DreamWeaver does allow me to connect and there's a lot I can do that way - but no importing of existing data that as far as I can tell.

LL

sprintserve
07-25-2004, 03:13 AM
If dreamweaver can connect, it means that you can connect remotely ... do you mean connect to your live database?

LotusLand
07-26-2004, 04:37 AM
DreamWeaver allows me to setup queries, sort tables, filter information, make recordset queries, but no importing or exporting of data. I have no shell or direct access to to mySQL files or advanced configuration.

Therefore, if DreamWeaver can interact, albeit in a limited way, with the database, all I need is a program that allows me to tunnel through a localhost connection via ftp account settings, but allows for independent passwords for ftp and database.

HTH

LL

adibranch
11-20-2005, 02:11 PM
Donhos tdont allow remote connections to their mysql on the unix reseller. You need a dedicated server to do this with donhost.

HostingEnthusiast
11-20-2005, 06:36 PM
Since your hosting company requires that you use their web-based SQL management interface, they probably block MySQL access at their firewall (and the previous post says that they do so Id assume that's correct). There may be some freely available web-based scripts meant for this situation as it is very common.

If not, you may be able to write a shell script that can be executed via CGI to import your database. You could try FTP'ing up your .sql file and write a script something like:

#!/bin/sh

echo "Content-Type: text/html"
echo
echo
echo "Running MySQL command... please wait"

mysql myuser_dbname < /home/myuser/my_db.sql 2>&!
echo "Well, I guess it completed with status $?"


You would need to upload the script in ASCII mode with your FTP program and set the permissions to 755 to use it. You should also create a file in your home directory called .my.cnf (needs the DOT at the beginning!) with your MySQL password, something like:

[client]
password=your_pass

The permissions on the .my.cnf should be 600 (hopefully CGI is suExec on your host) so noone can read it and you should also use a temporary password for your main MySQL user as a precaution. If all works well, it should output to your browser.

Some problems may be if /bin/sh is located elsewhere or has weird permissions, CGI not running as your username, mysql client is located somewhere that isn't in your path (such as /usr/local/mysql/bin/mysql), etc. This way will at least give you an error if the mysql client has a problem.

What your host is doing is actually a good idea to prevent any future mysql server remote exploits and because it limits abuse if a customer uses a dumb user/pass combination, but it does prevent legitimate users from having easy access. Something like phpMyAdmin might work as well -- most web-based administration tools have import functions. If you try out the script, let us know what the output is if there's an error and it may be helpful.