Author Topic: Accessing MySQL via php and/or design program  (Read 4447 times)

Frobozz

  • Jr. Member
  • **
  • Posts: 20
Accessing MySQL via php and/or design program
« on: March 12, 2010, 06:11:05 PM »
Ok, so I'm having problems in creating a new program to access a MySQL database on my site. 
I created a database.  Created a user.  Gave the user full authority over that database.  Went into phpmyadmin and created a table in the database and added a record into it.

I am trying to develop a web application using either Delphi for PHP or Dreamweaver CS4 (testing both out to see which I prefer to develop with).  Neither is able to connect to the database.  I assumed that maybe the database could only be accessed if the  files calling it were on the server, so I uploaded my work to my site and I still can't access it.  Then I figured, ok it MUST be these stupid development tools.  To test that out, I installed XAMPP on my pc, created an identical sql database and ran the php application from there. Run locally through XAMPP's mysql and apache servers, the applications run fine.   So I'm at a loss as to what I'm missing here or what I'm doing wrong that's preventing me from accessing the database on my site. 

I have tried using both www.(my domain name).com and localhost as the host parameter for the database.
I've also tried that host parameter with and without :3306 at the end of it.
The database name matches up to as it is shown in the mysql config screen in my cpanel.
The user name matches up to what is shown in the cpanel

Any advice any one has would be appreciated.




G.C. Admin

  • Performance Based Hosting
  • Administrator
  • Hero Member
  • *****
  • Posts: 990
Re: Accessing MySQL via php and/or design program
« Reply #1 on: March 13, 2010, 02:24:56 AM »
Sorry I missed this thread:

Remote Connection
 To connect to your databases is remotely. To do so, you should add your IP address in the "Access Hosts" section in the MySQL page. For example if your address is 1.2.3.4 you need to type it in the box and click on the "Add Host".

As before, this will lead you to a page where the cPanel confirms the successful adding of the host. A group of hosts can also be added by using the "%" symbol. For example "%.domain.com" will include ns1.domain.com, server1.domain.com, test.domain.com, etc.
Frank Doud
Owner/Operator
G.C. Solutions

Frobozz

  • Jr. Member
  • **
  • Posts: 20
Re: Accessing MySQL via php and/or design program
« Reply #2 on: March 13, 2010, 02:52:22 AM »
Frank,
Thanks.  I'll give that a go next week at work and let you know my results.

-Mitch



Frobozz

  • Jr. Member
  • **
  • Posts: 20
Re: Accessing MySQL via php and/or design program
« Reply #3 on: March 15, 2010, 03:47:49 PM »
To do so, you should add your IP address in the "Access Hosts" section in the MySQL page.

Um, I'm not seeing "Access Hosts".   Can I have another hint?



G.C. Admin

  • Performance Based Hosting
  • Administrator
  • Hero Member
  • *****
  • Posts: 990
Re: Accessing MySQL via php and/or design program
« Reply #4 on: March 15, 2010, 10:27:56 PM »
Sorry,

 Use the "Remote Mysql" Option then click Add Host

Frank Doud
Owner/Operator
G.C. Solutions

Frobozz

  • Jr. Member
  • **
  • Posts: 20
Re: Accessing MySQL via php and/or design program
« Reply #5 on: March 17, 2010, 06:24:08 PM »
Thanks, I finally got it to work.  I went in to add my IP Address to add it and found it already there (I guess I must have done that previously as I banged around for anything that might work), but the problem persisted.  Did a lot of googling on Delphi for PHP connecting to MySQL and found one guy who had a similar problem.  He said to fix it he had to create a new user for the database.  So I gave that a shot.  I created a new user and gave it authority over the database.  Low and behold, my connection problems disappeared.  There must be a MySQL  or CPanel bug where that original user I created wasn't created correctly.   Beats me but I'm just happy that it works now.    Thanks for your help Frank.



G.C. Admin

  • Performance Based Hosting
  • Administrator
  • Hero Member
  • *****
  • Posts: 990
Re: Accessing MySQL via php and/or design program
« Reply #6 on: March 17, 2010, 07:11:24 PM »
Thanks for passing over the solution.

I will pass that over to cPanel and see if that is SOP or a bug.


Thanks
Frank Doud
Owner/Operator
G.C. Solutions