Wamp PDOException: SQLSTATE[HY000] [1049]
Posted by: mrmaxwell (---.fbx.proxad.net)
Date: February 24, 2015 12:44PM

Good morning,

i'm experiencing an issue that is taking me hours despite it seems simple:

i use Wamp under Windows 7 and when i itry to access my database with PHP and the command :
$bdd = new PDO('mysql:host=localhost;dbname=bdd_reserv', 'root', '');
it gives me the error above with the message Unknown Database

So my database seems not to exist.
I created my database importing a script in phpmyadmin. Here is how it starts:

CREATE database bdd_reserv CHARACTER SET utf8;

use bdd_reserv;

create table regle...

As i look in the mysql prompt with show databases my database won't appear but it is displayed in phpmyadmin.

I tested the other way by creating a database in the mysql prompt and it did'nt appeared in phpmyadmin.

I kept the login data (root and no password) and i'm desperate to find an answer.

I would be thanksfull if you could help me.

Options: ReplyQuote
Re: Wamp PDOException: SQLSTATE[HY000] [1049]
Posted by: RiggsFolly (---.as43234.net)
Date: February 24, 2015 01:21PM

It sounds like you may have 2 MySQL servers running on your system.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Wamp PDOException: SQLSTATE[HY000] [1049]
Posted by: mrmaxwell (---.fbx.proxad.net)
Date: February 24, 2015 01:27PM

Thanks for replying,

i would say maybe but i'm not sure on how to check it.

Meanwhile i found some news : if i open a powershell prompt and connect with mysql -u root -p
then a show databases show me my phpmyadmin database...

Could it be that my php script do not manage to connect in root mode ?
Do i hava somthing to write before the new PDO object ?

Edit: the task manager shows me two process : mysql.exe and mysql.exe *32 is that what you were talking about ?



Edited 1 time(s). Last edit at 02/24/2015 01:28PM by mrmaxwell.

Options: ReplyQuote
Re: Wamp PDOException: SQLSTATE[HY000] [1049]
Posted by: RiggsFolly (---.as43234.net)
Date: February 24, 2015 01:37PM

Do I have more than one MySQL Server running?

Look at the services snapin

Press the Windows key + R
Keyin services.msc
Press the OK button

WampServers MySQL service is called wampmysqld or wampmysqld64 if you run the 64bit WAMPServer.

Normal installs of MySQL call the service MYSQL.

If you see both of these services, then you have to decide if you want to keep both MySQL Servers.

If ( KEEP ) {

From services snapin, STOP the MYSQL service
Also Right click on the line containing MYSQL Service and select Properties menu Item
Change the `Startup Type` to MANUAL so it does not start on Boot
From now on, if you want to use whatever installed the other MYSQL remember to STOP WAMPServer while using the other app

} else {

BACKUP databases created in other MYSQL, using the other App, a tool like MySQL Workbench or phpMyAdmin
UNINSTALL other MYSQL
Maybe, Restore the other databases to WAMPServers MySQL

}

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Wamp PDOException: SQLSTATE[HY000] [1049]
Posted by: mrmaxwell (---.fbx.proxad.net)
Date: February 24, 2015 01:40PM

Wow many thanks !

I had really another mysql server installed. I didn't remember but i had try to install it a few month ago and completely forgot about it. Once i uninstalled it everything worked righ.

Once again thanks a lot

Options: ReplyQuote


Sorry, only registered users may post in this forum.