itsacoolaccount
Posts: 19
Joined: Sun Mar 18, 2018 8:04 pm

[SOLVED]How to get a RDBMS server to "connect" with a web server?

Wed Apr 17, 2019 2:58 am

What I'm trying to do is to have a RPi act as an RDBMS and another RPi act as a Web server hosting Apache and Wordpress website. But thing is that the guide(https://www.raspberrypi.org/documentati ... /apache.md) I used to make my first website has the user create the MySQL DB in that same server but my objective is to have the MySQL DB on another server while Apache and Wordpress stay in the same server. Tell me if I need to clarify, thanks for the help.
Last edited by itsacoolaccount on Fri Apr 19, 2019 9:00 pm, edited 1 time in total.

Code: Select all

sudo apt-get install coffee

Andyroo

Re: How to get a RDBMS server to "connect" with a web server?

Wed Apr 17, 2019 11:24 am

Forgive the brief notes I’ve not got a box handy with this set up.

On the WordPress side you can set the server to be on a different system in wp-config.php https://codex.wordpress.org/Editing_wp-config.php. I cannot remember if the default install screen gives you the option or not (it may show 127.0.0.1 or local host)

MySQL or (MariaDB) by default does not allow remote connections for security but a small change to the configuration file and user settings will get you in.

Users need to be set along these lines:

Code: Select all

GRANT ALL ON WPData.* TO WPUser@'192.168.1.10' IDENTIFIED BY 'password';
where 192.168.1.10 is the web server IP address

The server itself needs to listen for requests from the web server and you edit my.cnf and set the bind-address = 192.168.1.10 (again the IP address of the web server)

Note migrating from this set up is more complex
I also recommend using static IP addresses for the servers
Im not sure of the speed impact on the Pi - WP is not the most compact of web pages.

fbe
Posts: 648
Joined: Thu Aug 17, 2017 9:08 pm

Re: How to get a RDBMS server to "connect" with a web server?

Wed Apr 17, 2019 5:20 pm

Andyroo wrote:
Wed Apr 17, 2019 11:24 am
The server itself needs to listen for requests from the web server and you edit my.cnf and set the bind-address = 192.168.1.10 (again the IP address of the web server)
Wrong. It needs to be an IP address of the machine, where MySQL/MariaDB server is running or 0.0.0.0 (what means that the server will listen on all network interfaces for connections).
If you are running Raspbian Stretch, edit /etc/mysql/mariadb.conf.d/50-server.cnf.
You need to restart the MySQL/MariaDB server if you changed the configuration.

Andyroo

Re: How to get a RDBMS server to "connect" with a web server?

Wed Apr 17, 2019 5:56 pm

Was bound to get one thing wrong from memory :lol:

Thanks for the fix - checking the box upstairs it’s 0.0.0.0 as it has got a few boxes feeding it.

itsacoolaccount
Posts: 19
Joined: Sun Mar 18, 2018 8:04 pm

Re: How to get a RDBMS server to "connect" with a web server?

Fri Apr 19, 2019 9:00 pm

Thanks for the help guys! With your instructions I got it working but at first WP wasn't detecting or having issues logging into the DB. I just redid the privileges for the DB and it fixed it, which then I reinstalled WP. Thanks for the help and attention!

Code: Select all

sudo apt-get install coffee

Return to “Networking and servers”