Erreur connexion MySQL, quell port ?
Posté : dim. 1 mars 2020 16:57
Bonjour,
J'ai lu le sujet avec le meme nom que vous avez donner le bon repons, s'il vous plait aidez moi aussi.
L'erreur est : Connection failed: SQLSTATE[HY000] [1049] Unknown database 'mabase'.
J'ai wampserver3 on Win 10. Il marche, mais pas avec mysql. Je voudrais travailler avec PDO:
//-------------------------------------------------------------------------------------------------------------
$server = "localhost";
$user = "root";
$pass = "";
$dbname="mabase";
$dsn="mysql:host=$server;dbname=$dbname";
try {
$connect = new PDO($dsn, $user, $pass);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connect -> exec("SET character_set_connection = 'utf8'");
$connect -> exec("SET NAMES 'UTF8'");
}
catch(PDOException $error)
{
echo "Connection failed: " . $error->getMessage();
}
//-------------------------------------------------------------------------------------------------------------
J'ai essaye de mettre des divers port pour mysql, mais je cois que j'ai une plus grosse pb.
Voila mes tests pour le port:
Je suis inquiete pour le message `N/A means that there are no service related to PID ...`
//-------------------------------------------------------------------------------------------------------------
***** Test which uses port 3307 *****
===== Tested by command netstat filtered on port 3307 =====
Test for TCP
Your port 3307 is used by a processus with PID = 8788
The processus of PID 8788 is 'mysqld.exe' Session: Services
The service of PID 8788 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 8788
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 468
Test for TCPv6
Your port 3307 is used by a processus with PID = 8788
The processus of PID 8788 is 'mysqld.exe' Session: Services
The service of PID 8788 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 8788
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 468
--- Do you want to copy the results into Clipboard?
--- Type 'y' to confirm - Press ENTER to continue...
//-------------------------------------------------------------------------------------------------------------
***** Test which uses port 3302 *****
===== Tested by command netstat filtered on port 3302 =====
Test for TCP
Your port 3302 is used by a processus with PID = 3364
The processus of PID 3364 is 'mysqld.exe' Session: Services
The service of PID 3364 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 3364
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 2840
Test for TCPv6
Your port 3302 is used by a processus with PID = 3364
The processus of PID 3364 is 'mysqld.exe' Session: Services
The service of PID 3364 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 3364
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 2840
--- Do you want to copy the results into Clipboard?
--- Type 'y' to confirm - Press ENTER to continue...
//-------------------------------------------------------------------------------------------------------------
...les memes pour d'autres valeurs.
S'il vous plait aidez moi,
Merci,
Flora
J'ai lu le sujet avec le meme nom que vous avez donner le bon repons, s'il vous plait aidez moi aussi.
L'erreur est : Connection failed: SQLSTATE[HY000] [1049] Unknown database 'mabase'.
J'ai wampserver3 on Win 10. Il marche, mais pas avec mysql. Je voudrais travailler avec PDO:
//-------------------------------------------------------------------------------------------------------------
$server = "localhost";
$user = "root";
$pass = "";
$dbname="mabase";
$dsn="mysql:host=$server;dbname=$dbname";
try {
$connect = new PDO($dsn, $user, $pass);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connect -> exec("SET character_set_connection = 'utf8'");
$connect -> exec("SET NAMES 'UTF8'");
}
catch(PDOException $error)
{
echo "Connection failed: " . $error->getMessage();
}
//-------------------------------------------------------------------------------------------------------------
J'ai essaye de mettre des divers port pour mysql, mais je cois que j'ai une plus grosse pb.
Voila mes tests pour le port:
Je suis inquiete pour le message `N/A means that there are no service related to PID ...`
//-------------------------------------------------------------------------------------------------------------
***** Test which uses port 3307 *****
===== Tested by command netstat filtered on port 3307 =====
Test for TCP
Your port 3307 is used by a processus with PID = 8788
The processus of PID 8788 is 'mysqld.exe' Session: Services
The service of PID 8788 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 8788
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 468
Test for TCPv6
Your port 3307 is used by a processus with PID = 8788
The processus of PID 8788 is 'mysqld.exe' Session: Services
The service of PID 8788 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 8788
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 468
--- Do you want to copy the results into Clipboard?
--- Type 'y' to confirm - Press ENTER to continue...
//-------------------------------------------------------------------------------------------------------------
***** Test which uses port 3302 *****
===== Tested by command netstat filtered on port 3302 =====
Test for TCP
Your port 3302 is used by a processus with PID = 3364
The processus of PID 3364 is 'mysqld.exe' Session: Services
The service of PID 3364 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 3364
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 2840
Test for TCPv6
Your port 3302 is used by a processus with PID = 3364
The processus of PID 3364 is 'mysqld.exe' Session: Services
The service of PID 3364 for 'mysqld.exe' is 'N/A'
N/A means that there are no service related to PID 3364
Processus 'mysqld.exe' is launched by service 'wampmysqld64' with PID 2840
--- Do you want to copy the results into Clipboard?
--- Type 'y' to confirm - Press ENTER to continue...
//-------------------------------------------------------------------------------------------------------------
...les memes pour d'autres valeurs.
S'il vous plait aidez moi,
Merci,
Flora