A
A
Artyom2021-01-26 00:49:35
MySQL
Artyom, 2021-01-26 00:49:35

How to allow connection to the database from a specific host in openserver?

I want to make it possible to open a site that distributes OpenServer on my router's local network. To do this, I changed the server in the OpenServer settings and made an alias from this ip-address to the site itself. I changed the database server in the site's config, but the site still can't connect to the database. When I try to login to phpmyadmin I get an error

mysqli::real_connect(): (HY000/1130): Host 'hikers' is not allowed to connect to this MySQL server

Where hikers is the name of the site I'm migrating. If I understand correctly, I need somewhere to put access to the database from the hikers host. However, I did not find on the Internet how this can be done specifically in OpenServer. Please help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2021-01-26
@SilenceOfWinter

if the base is on the same host as the site, then connect to localhost/127.0.0.1, otherwise - specify the ip address of the host with the base

D
Daniil Vasilyev, 2021-01-26
@hello_my_name_is_dany

In PhpMyAdmin, you can create a user with a specific host through the interface.
600f4d0cca332792300832.png
Or via SQL

CREATE USER 'remoteUser'@'192.168.0.110' IDENTIFIED BY 'my_cool_remote_password'

And it's somehow more practical to operate with IP addresses, not hosts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question