Stack Overflow上有很多关于此主题的问题,但它们都不匹配我的案例。PDO :: __ construct():php_network_getaddresses:getaddrinfo失败:名称或服务未知
我正在使用Lampp与PHP 5.4.7,它运行良好,直到我开发我的第一个PDO程序在PHP中。
当我使用
$con=new PDO("mysql:host='localhost';dbname='data';charset=utf8",'root','');
连接我得到这个error.Do我需要激活php.ini的东西吗?
(*有关*)为什么PHP PDO DSN为MySQL与PostgreSQL的不同的格式?(http://stackoverflow.com/questions/237367/why -is-php-pdo -dsn -a -format-for-mysql-versus-postgresql) –