Question

I am trying to create a simple web app that prints out database info from MariaDB/MySQL using PHP, im not even at that stage yet... I have trouble when connecting to the database and get the following error:

Host '10.155.237.62' is not allowed to connect to this MariaDB server

Now, I have not done a secure installation so my Mariadb Server allows access from wildcard host and infact any host.I have also tried the code with the root account but received the same error. Can anyone tell me if its my code or whether its a procedure im not aware of that disallows connectors to access the information?

Here is my code:

<?php
$con=mysqli_connect("vm-007.server.com","testuser","testpass","my_db");
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MariaDB: " . mysqli_connect_error();
  }
?>

Thanks in advance!

Was it helpful?

Solution

i would test your mysql database access from command line from remote machine

mysql -h vm-007.server.com -u testuser my_db -p

it will ask you for a password and type that in.

If it fails then you are probably dealing with a mysql setup problem.

likely you are dealing with something like the mysql daemon only listening to the localhost interface i.e. 127.0.0.1 . Even if it allows access from any host if it isn't listening to a give interface like eth0 it doesn't matter.

OTHER TIPS

If you have not created a database, do it from a cmd prompt:

CREATE DATABASE blobblablob;

Now use the USE keyword for that name like so:

USE blobblablob;

Now give yourself permission to use your database:

GRANT ALL ON 'blobblablob' TO 'me'@'localhost' IDENTIFIED BY 'mypassword';

Don't forget to end all your statements with a ; (semicolon). Now get out of the cmd prompt by typing exit. You can check in your browser your PHP scripts. They should start working for that database now since you have the controluser permissions.

Go to user account->add user account->create account with user name and password... let host name be %...click ok

click privileges on created user and grant global permission.

then change ur localhost name as ip:192.168.3.2 and username as newcreatedusername and password .... save it.

open your application from any other remote system along with ip:port ---192.168.1.2:9090/dashboard/working-files/welcome.php-------press enter

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top