473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

can't connect to the remote MySQL db

76
hi,
can anyone tell me what am i doing wrong here. i'm trying to connect remotely to the MySQL database on a server (SunOS multivac 5.9 sparc SUNW,Sun-Fire-V240). i know that the username and the password are correct, but it keeps giving me this error:
DBI connect('mydb:myhostname:1234','username',...) failed: Access denied for user 'username'@'compname-345-56.abcd.edu' (using password: YES) at myscript.pl line 5
Error: Access denied for user 'username'@'compname-345-56.abcd.edu' (using password: YES)

i would appreciate your help.


Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use DBI;
  4.  
  5. my $dbh = DBI->connect ("DBI:mysql:mydb:myhostname:1234","username","password") or die "Error: $DBI::errstr\n";
  6. my $sql = "SELECT info FROM mytable limit 2";
  7. my $in = $dbh->prepare($sql);
  8. $in->execute;
  9.  
  10. print "Content-type: text/html \n\n";
  11. print STDOUT "$in\n";
  12.  
Oct 13 '07 #1
2 2199
mwasif
802 Expert 512MB
You must have to GRANT permissions to user username to connect remotely.
Nov 6 '07 #2
...which is cause of security-point.. disabled ;) (networking disabled)

to "bypass" that, you could use Putty to make a port-tunnel, so your script would connect to 127.0.0.1 to port xxxx which just forward you trought putty-tunnel into remote machine and connect there as "localhost" which is normaly not restricted..
(for this case u should have a shell access to the remote machine!)
if not, then ...just put the php on the remote machine (since u have sql access, u should have ftp access too, else you have got a real problem ^^)

guide for putty:(
Configuration -> Connection -> SSH -> Tunnels
add there in "source port" the port your php script is using, normaly 3306
in Destination add sth like 127.0.0.1:3306 and let protocol and direction both at "auto"
then just click add ..et vóila XD , connect per ssh to the shell, now u can start your php script on your local machine (where u changed the host to 127.0.0.1 XD) and it will work
);

regards
cracky
Nov 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Eric W. Holzapfel | last post by:
Hello PHP group, I have mysql running on a linux box. I have apache (2.0.4) running on a diff linux box. I have php 4.X. I can connect to the mysql db using odbc from a windows box, but...
1
by: webhead74 | last post by:
Hi, I've worked on this for a couple of days & can't figure out what I'm doing wrong. I'm trying to connect to a remote AS400 database using odbc & php. Here's my environment: Server: RedHat...
0
by: Ryan Stewart | last post by:
I'm running MySQL server on a WinXP box at home. I have a cable modem/router. I've set up port forwarding on port 3306 to the machine running MySQL. I can connect locally just fine, but when I try...
3
by: Sander Smeenk | last post by:
Hello! I'm trying to set up replication between two servers and even though I did everything according to the documentation, the slave keeps failing to connect to the master like this: |...
16
by: MLH | last post by:
Using MS Access, I have attached to MySQL servers in other states and other countries on the other side of my router. But when I use the MySQL ODBC driver 3.51 to connect to a MySQL server on my...
1
by: linux | last post by:
Sorry if this is a really dumb question. I am trying to connect to our remote MySQL server (which is running just fine). I have a perl script which worked just fine on my other Fedora 4 box (all...
47
by: Lauren Wilson | last post by:
One more try. After ransacking the Desktop AND Enterprise edition of Ken Getz Dev Handbooks on Access 2002, I STILL don't know if it is or is not possible to link a client side MDE with a WEB...
4
by: courtney.machi | last post by:
Hello, I am trying to connect to a remote mysql server through php. Here's the code: mysql_connect("my.hostname.edu", "username", "password") or die (mysql_error());...
1
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.