cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

connecting to a mysql db thru php

hello, 

New to cpanel, I had an old hosting account on a shared linux server, everything worked great, I moved over to cpanel and it is not going so well, I backed up my mysql db, restored it , all rows show up in cpanel.  I changed my login script to indicate localhost as the servername but It won't let me connect.  I read that I needed to change the usernames password, I tried that and no help.  I have tried both localhost and localost:3306, I have even tried the ip adx 1.1.1.1:3306 (obviously not the actual ip address).  And ideas?  I did go into remote mysql and added my host ip address and even a % just to see if it would help, it didn't.

 

TIA.

5 REPLIES 5
Super User III
Super User III

Re: connecting to a mysql db thru php

@gdgdaddy 

 

So I have a question or two

 

1) How did you create the database on the new server?

2) Did you assigned permissions to the user to the database?

3) Do you have any error code in your PHP to see if it isn't connecting or a bad password or something else?

 

 



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

Re: connecting to a mysql db thru php

Thanks for replying,

I don't know how I created the database to be honest with you, when I loaded cpanel it was there.  Named correctly?  I wondered how that happened.  I did not assign any permissions yet, how would I do that?  No, I get no mysqli_error ,I have it printing, but nothing shows.

Super User III
Super User III
Solution

Re: connecting to a mysql db thru php

@gdgdaddy 

 

When you are in cPanel there should be a section that has

phpMyAdmin, MySQL Databases, Database Wizard and Remote MySQL

 

If you goto the MySQL Databases, you should have the options to check & repair the databases as well as managing users.

 

Near the top you should see your database and "privileged users"  - I suggest scrolling down to where it says Add User To Database, then you can add the user and on the second screen select all - to grant all the permissions to the user

 

 

 



I am a GoDaddy End User - Just Like You
Check out my site! | I currently manage over 300 WordPress Websites
* Please note that I offer free advice on this forum. If you would like personalized help, please contact me. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community

Re: connecting to a mysql db thru php

assigning the user permissions took care of my problem.  Thank You Very Much. 

Re: connecting to a mysql db thru php

When I first came across this error, I thought I was stupidly making a mistake with the connection command but I have run out of ideas what that stupidity might be.  There is an alternative scenario that I am now considering.  First, some background:

 

I already successfully run this application (and a couple of other MySQL applications) on an older hosting platform on GoDaddy.  I am porting the application to a platform that uses cPanel for a friend (this is all volunteer work in support of local history research).

 

For a number of years GoDaddy has been suggesting I port my site to cPanel.  I could not see any advantage in doing so and did nothing.  Then earlier this year GoDaddy told me that they were going to move the site to cPanel.  A little later the MySQL applications stopped working.  GoDaddy support said this was a Chrome browser problem and that Chrome in incognito mode and other browsers would work, which seemed to be correct.  The next day the problems disappeared and I presumed, not knowing anything about cPanel, that the port was successful.  I now realize that the port was abandoned and that the site is still running on the old platform.

 

There must be GoDaddy engineers that understand what is going on but I have no way of communicating with them.

 

I am going to withdraw this issue until I can better characterize it.