Author |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Thu 03 May '12 1:33 Post subject: MySQL database connection failure |
|
|
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
|
Posted: Thu 03 May '12 3:20 Post subject: |
|
|
try
$database_host = "127.0.0.1"; |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Thu 03 May '12 4:33 Post subject: |
|
|
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
|
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Fri 04 May '12 0:08 Post subject: |
|
|
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
|
Posted: Fri 04 May '12 12:31 Post subject: |
|
|
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
|
Posted: Fri 04 May '12 15:01 Post subject: |
|
|
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
|
Posted: Fri 04 May '12 19:53 Post subject: |
|
|
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!!!!!! |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Fri 04 May '12 22:21 Post subject: |
|
|
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
|
Posted: Fri 04 May '12 22:27 Post subject: |
|
|
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 |
|