I have installed my sql database with windows authentication, but now don't know how to connect to it.
The message I am getting is
Error
php_network_getaddresses: getaddrinfo failed: No such host is known.
/the database is on my local PC and I copied the path to it which is
"C:\Users\MyName\Documents\My Web Sites\For evaluation-3col\App_Data\test.sdf"
so the command line is
$dbc = mysqli_connect("C:\Users\MyName\Documents\My Web Sites\For evaluation-3col\App_Data\test.sdf")
or die(mysqli_connect_error())
I am a very new person to this and would really appreciate help.
Thanks
Related
I have installed XAMPP on windows 10 but cannot open phpMyAdmin. I had to change Apache port 443 to 4433 because of conflicts and now both apache and mysql are running. When I click on phpMyAdmin on my server it gives me the following message in a pink box:
MySQL said: Documentation
Cannot connect: invalid settings.
mysqli::real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
Connection for controluser as defined in your configuration failed.
mysqli::real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
I've read the questions on similar problems but they mostly happened when someone changed the password, but for my case, the user is set to root and the password is empty both in MySQL server connection and in the config.inc.php file. I have no clue where to look for the problem.
What version is your XAMPP? Try going to task manager, locate mysqlI and end task. Now close the XAMPP window and open it again. Go to Mysql and try test the connection by connecting to the database on port 3306. If it gives en error check the error log in the XAMPP.
I am trying to connect from my PC to a database that is hosted by knowhost.
$con = new mysqli('188.214.58.120','user','pass','db');
When i compile this it shows me this: mysqli::__construct(): (HY000/2002): No connection could be made because the target machine actively refused it.
Where is the problem?
This is db.php IM USING CLOUD9 as my host
function getDB() {
$dbhost="paralphdigm-vtms-2622120";
$dbuser="paralphdigm";
$dbpass="";
$dbname="vtms_db";
$port = 3306;
$dbConnection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $dbConnection;
}
I edited my code to this now*
Heres the error message
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused' in /home/ubuntu/workspace/db.php on line 8
php_network_getaddresses: getaddrinfo failed: Name or service not
known
In non-technical words, this error message means: "I don't know the address of the server."
In technical words, it means the hostname you try to connect to has no public nameserver record.
The database server is only accessable from within a few specific servers, as a security feature, to prevent the whole world from accessing it. So not everyone can try to hack or overload (DoS) it!
A host that is allowed to connect to the database server might most probably be the server you upload your html/php/.. files to.
Although you are mixing PDO, MySQLi and mysql, which is bad, the error is caused by network related stuff, not by programing mistakes.
The question changed completely after your edit.
"Connection refused" means your host knows the address and can reach the database server, but it is not allowed to connect. It refers to the same situation as before, your host is "in a different neighborhood" now which still is not "friendly" to the db.
I am receiving the error while using push notification (adhoc certificate) from php side. like this.
stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known) in /usr/local/www/apache24/data/appmantras/community/apple/push.php on line 19
I have one doubt that where I need to create *.csr file i.e from my development mac system or server system. (Now I have created from my mac system only.)
I have some problems with ftp_connect(); I can't connect to my own FTP-server via ftp.localhost or ftp.edgren.myftp.org. I got this error message when I try to connect:
Warning: ftp_connect() [function.ftp-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in ...
I use this code: $conn_id = ftp_connect('ftp.localhost') or die("Couldn't connect to localhost");
What's the problem? I use the basic FTP-server program Wing FTP Server to host my server.
Thanks in advance.
Try connecting to 127.0.0.1. Localhost is just an alias to that IP, so if localhost doesn't work, the IP will.