Can't connect to Mysql through PHP (solved)

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Can't connect to Mysql through PHP (solved)

Postby Fossy » 19. November 2011 04:34

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!!
Last edited by Fossy on 19. November 2011 19:38, edited 1 time in total.
Fossy
 
Posts: 6
Joined: 01. October 2011 01:29
Location: Huelva - Spain
Operating System: Linux Fedora 15 Lovelock 64

Re: Can't connect to Mysql through PHP

Postby Sharley » 19. November 2011 04:56

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. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Can't connect to Mysql through PHP

Postby Nobbie » 19. November 2011 11:51

Please tell us more (i.e. anything) about your linux distribution. Which linux is installed on that server?
Last edited by Sharley on 19. November 2011 11:59, edited 1 time in total.
Reason: Please add your current full OS version and your current XAMPP version to your profile - see the forum announcement.
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04

Re: Can't connect to Mysql through PHP

Postby Fossy » 19. November 2011 19:37

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!!
Fossy
 
Posts: 6
Joined: 01. October 2011 01:29
Location: Huelva - Spain
Operating System: Linux Fedora 15 Lovelock 64

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

Postby Sharley » 19. November 2011 23:47

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

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

Postby Sharley » 20. November 2011 01:15

Thank you Fossy your profile is now correct.

Best wishes.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 5 guests