Page 1 of 1

Can't connect to Mysql through PHP (solved)

PostPosted: 19. November 2011 04:34
by Fossy
Hello friends:

I have Xampp installed and running (all ok!). I can connect it by /opt/lampp/bin/mysql -p, I have imported databases files from other server (I'm migrating) and all work fine, I can connect with any user, view tables, etc., but I can't connect through PHP (web way). I get this:

Database Error: Unable to connect to the database:Could not connect to MySQL

This is with all my web-domains that I have hosted. I'm migrating from other server and all configuration, databases, domains, webs... all is cloned. In my other server all works fine (Xampp - Mysql - PHP - Apache), but here in new server I only can connect through linux console.

I try: telnet localhost 3306 and connection is refused. I can't see anything bad on my.cnf file.

Any ideas?.

Thanks!!

Re: Can't connect to Mysql through PHP

PostPosted: 19. November 2011 04:56
by Sharley
Hello Fossy, welcome back. :)

Please add your OS version and XAMPP version to your profile:
viewtopic.php?f=17&t=48626

Check that MySQL is running.
Check that a firewall is not blocking port 3306.
Those seem to be the favourite responses to your issue but below you may find many more.

Try these finds:
http://213.136.52.31/mysql/186280

A possible solution here:
http://w3schools.invisionzone.com/index ... opic=37469

Here is a Google Search I used.

Good luck. :)

Re: Can't connect to Mysql through PHP

PostPosted: 19. November 2011 11:51
by Nobbie
Please tell us more (i.e. anything) about your linux distribution. Which linux is installed on that server?

Re: Can't connect to Mysql through PHP

PostPosted: 19. November 2011 19:37
by Fossy
SOLVED!!

Thanks for all.

The problem was that I imported all databases from old mysql server, and older user database running in new mysql server (5.5.16) the result is "database corrupt", because mysql_convert_table_format can't repair it.

Be carefull to users that is migrating databases, because this issue is not docummented and I can't locate help using google.

I repair it reinstalling Xampp, importing all my databases (except information_schema, cdcol, mysql and test) and introduced by hand the users (this has served me to make clean). Mysql now is working perfect! :).

Thanks!!

Re: Can't connect to Mysql through PHP (solved)

PostPosted: 19. November 2011 23:47
by Sharley
It is now a requirement of membership to the Apache Friends forums that you provide your correct Operating System Version and the correct XAMPP version.viewtopic.php?f=17&t=48626
viewtopic.php?f=17&t=48626

Nobbie and Fossy have both been requested to provide this information and so far have not complied.

It may come to the point where members who choose to ignore these request may have to register again, where providing that information is compulsory to continue with registration to the Apache Friends forums.

Re: Can't connect to Mysql through PHP (solved)

PostPosted: 20. November 2011 01:15
by Sharley
Thank you Fossy your profile is now correct.

Best wishes.