MODX Cannot Connect to MySQL Using VPS Managers (Ploi, Server Avatar, Cleavr)

I’m posting here just in case anybody else has seen something like this: I am trying to launch MODX using Ploi and/or Cleavr which are interfaces that connect to and deploy VPS servers to multiple modern providers like Linode, Digital Ocean, Vultr, etc.

The problem I’m running into is that MODX cannot connect to the MySQL database on any of these setups. They’re running NGINX on Ubuntu 20.04 with MySQL 8 and PHP 7.4.

I can connect using PHP myadmin, and Wordpress works without a problem. But during installation, MODX can never ever connect to the db. Is there something that I need to change in an LEMP setup to allow MODx to connect to MySQL?

Hi, there’s nothing particular on MODX installation that would case connection issues beyond config params, are you sure the DB server is visible on the PHP side using the exact same data you are using on the installer? try a simple connect/query script and see what errors are you getting, and you can go from there

Hey, did you find a solution? I have the same issue…

@pfeifakopf I did solve it.

I had to create the MySQL user and assign all database permissions manually. This can be done in command line or by installing PHPMyAdmin.

In the dashbaord of these modern hosting platforms, you can see the user being created. But they do not GRANT permissions or allow you to manage db permissions from the UI. This is by design and I have confirmed with their support teams. See the following note from Cleavr support. I think it would be nice if they made that clear. But in my testing of all of them, I never saw that information published anywhere.

Ah! Yeah, we don’t allow for changing permissions to db users via the dashboard, generally. As we don’t like the potential security risks. You’d need to update permissions via SSH terminal.

1 Like

Thanks for your help. The connection to the database works fine now. Last problem that I have is, that I don’t get mod_rewrite working with nginx. How did you solve this?

I believe that’s where I hit a wall. I never got that working. After 21 days of working through the bugs, I just moved all of my MODX instances back to cPanel.

Ah, OK. My sites are working without seo friendly urls. Here is an example for the nginx config, but right know I don’t get it.

https://docs.modx.com/3.x/en/getting-started/friendly-urls/nginx

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.