logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: MySQL database connection failure
Author
rob62



Joined: 22 May 2007
Posts: 54
Location: mi

PostPosted: Thu 03 May '12 1:33    Post subject: MySQL database connection failure Reply with quote

Win 7 x64
apache 2.2.21
PHP 5.3.10
mysql 5.5.20
localhost computer

I created a database with password using PHPadmin. When I attempt to create connection to it using a html script(I think that's what it is called.), inputting the database, username and password, I receive message,

"Information saved but connection failed. One or more of the following is incorrect: Host Name, Database Name, Database Username, Database Password.".

The Database Name, Database Username, Database Password were saved to the configuration file correctly.

$database_host = "localhost";
$database_name = "food";
$database_username = "xxxxxx";
$database_password = 'yyyyyyyyy';

Update

Could not connect to MySQL because: Access denied for user 'craig'@'localhost' (using password: YES)

MYsql log:

120502 13:01:26 [Note] Plugin 'FEDERATED' is disabled.
120502 13:01:26 InnoDB: The InnoDB memory heap is disabled
120502 13:01:26 InnoDB: Mutexes and rw_locks use Windows interlocked functions
120502 13:01:26 InnoDB: Compressed tables use zlib 1.2.3
120502 13:01:26 InnoDB: Initializing buffer pool, size = 128.0M
120502 13:01:26 InnoDB: Completed initialization of buffer pool
120502 13:01:26 InnoDB: highest supported file format is Barracuda.
120502 13:01:26 InnoDB: Waiting for the background threads to start
120502 13:01:27 InnoDB: 1.1.8 started; log sequence number 1727973
120502 13:01:27 [Note] Event Scheduler: Loaded 0 events
120502 13:01:27 [Note] wampmysqld: ready for connections.
Version: '5.5.20-log' socket: '' port: 3306 MySQL Community Server (GPL)
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 03 May '12 3:20    Post subject: Reply with quote

try
$database_host = "127.0.0.1";
Back to top
rob62



Joined: 22 May 2007
Posts: 54
Location: mi

PostPosted: Thu 03 May '12 4:33    Post subject: Reply with quote

Thanks for responding.

That did not work. The install worked before. I don't know what is different.

vhosts file:

<VirtualHost *:80>
DocumentRoot "G:/wamp/www"
ServerName 127.0.0.1
ServerAlias localhost
</VirtualHost>


<VirtualHost *:80>
DocumentRoot "G:/test"
ServerName test
ServerAlias test
ErrorLog "G:/test/logs/test-error.log"
CustomLog "G:/test/logs/test-access.log" common
<Directory "g:/test">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from test
</Directory>
</VirtualHost>
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Thu 03 May '12 5:26    Post subject: Reply with quote

I had a similar issue when I set up MySQL on my machine where I locked myself out of MySQL (which I was using for WordPress). There is a command you can use to reset the password for MySQL. Perhaps this link might help?

http://dev.mysql.com/doc/mysql-windows-excerpt/5.0/en/resetting-permissions-windows.html

Just putting my 2cents worth in.

-S
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Fri 04 May '12 0:08    Post subject: Reply with quote

Here is a simple PHP script to test if MySQL is working

<html>
<head> <title>MySQL Test</title> </head>
<body>
<h1>
<?php $connection=mysql_connect("localhost","USERNAME","PASSWORD")
or die("Could not connect to MySQL");
echo "Successfully connected to MySQL";
?>
</h1>
</body></html>

Save as a .PHP file and be sure to replace with USERNAME and PASSWORD for your MySQL server
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 04 May '12 12:31    Post subject: Reply with quote

I wish to point out that on Win Vista/7, localhost point to the IPv6 IP of ::1. Unless something has changed, mysql is not IPv6 compatible. This is why I suggested setting it to 127.0.0.1
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 04 May '12 15:01    Post subject: Reply with quote

glsmith wrote:
I wish to point out that on Win Vista/7, localhost point to the IPv6 IP of ::1. Unless something has changed, mysql is not IPv6 compatible. This is why I suggested setting it to 127.0.0.1


it is not MySQL, unless you bind it to 127.0.0.1. The php mysql connector does not like IPv6. Cause my other programs can easily connect via IPv6
Back to top
rob62



Joined: 22 May 2007
Posts: 54
Location: mi

PostPosted: Fri 04 May '12 19:53    Post subject: Reply with quote

The msql test failed.

By default, there is no root password.
I figured out how to set a password for "root" and I'm locked out of everything.
No option to enter password.

Everything returns "You don't have permission to access /gen/admin.php on this server."

No access to PHPadmin!!!!!! Embarassed Rolling Eyes Mad
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Fri 04 May '12 22:21    Post subject: Reply with quote

Rob:

Did you try the link I posted for resetting the password/s in MySQL?

- S
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Fri 04 May '12 22:27    Post subject: Reply with quote

My Setup:

Win 7 x32
Apache 2.4.2
PHP 5.4.2-dev
mySQL 5.6.5 m8
phpMyAdmin 4.0.0-dev
localhost computer

Let me know if you want to see any of my configs.

- S
Back to top


Reply to topic   Topic: MySQL database connection failure View previous topic :: View next topic
Post new topic   Forum Index -> Other Software