我正在运行我从docker hub mongo image中提取的mongo docker图像
它工作正常,但是当我启动Robomongo时,我无法连接到localhost.有以下错误消息:
无法在localhost:27017连接到MongoDB.
错误:网络无法访问
我感谢任何帮助,谢谢.
编辑:我使用以下命令解决了这个问题:
docker run -p 27017:27017 --name mongo_instance_001 -d mongo
我有一个 mysql 数据库和一个用户表。我正在尝试匹配用户名和密码。我的查询方法返回 false,但我从 mysql 数据库中检查了它,它应该是 true。谁能弄清楚为什么会发生错误?
我在 stackoverflow 中看到过类似的问题,但似乎没有用。谢谢。
连接.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if( isset($_GET['Login']) ){
// Create connection
$config = parse_ini_file('config.ini');
$conn = new mysqli($config['host'], $config['username'],
$config['password']);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully\n";
$username = $_GET['username'];
$password = $_GET['password'];
var_dump($username);
var_dump($password);
$sql="SELECT * FROM `User` WHERE `username`='$username' and `password`='$password'";
var_dump($sql);
$result=$conn->query($sql);
var_dump($result);
$count=$result->num_rows;//This is line 37
var_dump($count);
// If result matched $username and $password, table row …Run Code Online (Sandbox Code Playgroud)