Remote connection Mariadb


#1

Hi

I am using MariaDB v10.1.36

I attempting to configure remote access in my.cnf file on my Centos 7 Server locates at /etc/my.cnf

All the instructions I can find say locate [mysqld] and comment out skip-networking and bind-addres.

However, when I go into this file it only has the following :

#
# This group is read both both by the client and the server
# use it for options that affect everything
# hashed out september 10 2018
[client-server]

#
# include all files from the config directory
# hashed out september 10 2018
!includedir /etc/my.cnf.d

I then just tried adding:

[mysqld]
bind-address = 0.0.0.0 
skip-networking

I created a test database, gave a user the correct remote IP access, flush privileges and restarted MariaDB.service with systemctl

However, I still can’t get remote access.

Also I am a little flummoxed that I cannot see any of he material that I am supposed to see in this file.

The objective is realltbjust to be able to access MariaDB remotely

Any suggestions would be deeply appreciated.

Thanks
Karen


#2

You probably don’t need to edit the config files. Just add a user who can connect remotely and open port 3306 on the firewall.


#3

Not working - on a Centos7.

I am having someone help me look at it, if I get an clear answer, I will post it back here.


#4

Make sure that port 3306 is opened to the world.

Then, when creating the remote user, specify that he/she can connect from any host by using the ‘%’ character e.g.

mysql>CREATE USER 'sample_user'@'%' IDENTIFIED BY 'PASSWORD';
mysql>GRANT ALL ON  *.* TO 'sample_user'@'%';
mysql> FLUSH PRIVILEGES;

In case this does not work change the IP address on the bind-address from 0.0.0.0 to your public IP address. You can check your public IP address by visiting the link https://whatsmyip.com/

Also, depending on your hosting provider, ensure that firewall rules defined on the dashboard can allow external connections to port 3306.

Hope it works.


#5

Hi thanks

It ended up being SElinux that was causing the problem. The error was ocurring on the web server - not the database server.

Sudo sestatus

Then I set appropriate permissions on the app server and all was well! It took me forever to get that one.

Also the config files for mysqld are in server.cnf not my.cnf —- Which is what it says everywhere on the forums.

Hope that helps someone else.

Thanks for everyone man suggestuons on it :smile:

Karen