mysql_connect("localhost", "root", "" );et je n'ai aucune erreur.
echo mysql_connect("localhost", "root", "" ) ? 'true' : 'false';, je récupère "true"
echo mysql_connect("toto", "root", "" ) ? 'true' : 'false';, je récupère :
Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: Hôte inconnu. in C:\wamp\www\test.php on line 3 Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: Hôte inconnu. (trying to connect via tcp://toto:3306) in C:\wamp\www\test.php on line 3 Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: Hôte inconnu. in C:\wamp\www\test.php on line 3 false
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost(tout est en commentaire)
# Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost ::1 localhost
B 5.1.36-community-logCihM+,;%ÿEmrx%I!dZtYA, et au bout de quelques secondes je perds la connexion.
<?php $connectionString = 'mysql:host=localhost;port=3306'; $pdo = new PDO( $connectionString, 'root', ''); echo $pdo ? 'true' : 'false'; ?>mais bon, il doit y avoir un autre problème, parce que phpMyAdmin fonctionne.
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING TCP 127.0.0.1:49210 127.0.0.1:3306 TIME_WAIT
Citation
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING
TCP 127.0.0.1:52032 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:52033 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:52034 127.0.0.1:3306 TIME_WAIT
<?php echo mysqli_connect('localhost', 'root', '') ? 'true' : 'false'; ?>