Я могу подключиться к серверу mysql с помощью ssh.подключиться удаленно к серверу mysql с php
# mysql -u username -h 185.2.3.80 -ppasword
выход:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 280
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Я хочу подключиться к серверу MySQL с PHP:
<?php
$servername = "185.2.3.80";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
это выход:
Could not connect: Can't connect to MySQL server on '185.2.3.80' (13)
отключить брандмауэр с iptables и удалить bind-адрес и skip-net работая из my.cnf. но не могу подключиться к php.
я проверить, но это не работает – adib16
И после этого руководства? https://technique.arscenic.org/lamp-linux-apache-mysql-php/mysql-le-serveur-de-bases-de/article/acces-distant-a-un-serveur-mysql – Zl3n