I'm trying to have remote access from a web service in PHP, to MySQL data base in a server which is a cluster (1 manager and 2 nodes)
I connected via ssh to the manager and both nodes, and gived permissions to my root user from another ip
grant all privileges on database.* to root@remoteip identified by 'password';
flush privileges;
I'm trying to connect to the database from my web service with the mysqli function
$mysqli = new mysqli(manager ip, root , password , database);
if (mysqli_connect_errno()) {
echo "Error";
}
else{
echo "Connected";
}
But I can't have a connection from my web service. But if I ssh my web service server and connect to MySQL remotely to the manager and nodes, I do have a connection
mysql -u root -p -h managerip
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.0.95-log Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]>