I am running a cgi script on an ISP-hosting server that accesses a MySQL database. This script works fine when using anyother type of database, but when I try to set it up for MySQL, it cannot connect. Here is where it gets interesting: When log I onto my server space via SHH/Shell access everything works FINE! And the script can access the SQL database no problem... it's only when I'm not logged onto SHH/Shell that I have a problem.
What would signing into SHH/Shell change as far as accessing MySQL and hence give me some idea how to fix this?
More info:
- The script is owned by my user (bsharp)
- The MySQL.sock is owned by user MySQL
- The actual database I created is owned by MySQL
- I'm using a perl command like DBI:mySQL:database:host
- The script is the gnu INTERCHANGE ecomerce dameon
- My hosting provider uses cpanel
Requires Free Membership to View
Many ISPs do not allow access to port 3306 (the MySQL server TCP/IP port) from outside their firewall. If this is the case, you can still attempt remote access by using SSH tunneling. I have a tutorial on the subject (in a Windows context) at http://www.vbmysql.com/articles/security/sshtunnel.html, and a Web search on the subject should yield a variety of other tutorials.
For More Information
- Dozens more answers to tough MySQL questions from Mike Hillyer are available here.
- The Best MySQL Web Links: tips, tutorials, scripts, and more.
- Ask the Experts yourself: Our SQL, database design, SQL Server, DB2, Sybase, MySQL, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in May 2004

Join the conversationComment
Share
Comments
Results
Contribute to the conversation