I need some help locally connecting a db to a website I host

I need help…

I took over hosting a website for a small community of flight simmers, the one thing I was unable to get working was the databases locally, even though I hated the idea of letting someone continue to host the databases(because its on really crappy hosting)I had no choice. Now there are more issues than ever because the whole site lags out constantly when in high use(which makes sense to me). When I tried to host them locally on my vps the DB user had issues inserting into the database regardless of the permissions, and the person who made the website is no help.

I am unsure how to exactly find the solution OR how to ask for help. The web dev who made the website is very cpanel reliant and is no help…Is there anyone here who could help me or let me know what to share for advice?

Sorry for being vague,

I greatly appreciate any input AT ALL
<3

From the sound of it, MySQL?

If so, you will need to create a new user with appreciate (write + read) permissions to the database tables.

Typically if the database is hosted on the same server as the web server then it’s fine, otherwise you need to follow the documentation for remote connection.

Hopefully this points you in the right direction.

yes sir mySQL, for even troubleshooting purposes I gave that user grant permissions and still have no luck, unfortunately I have no real good experience with PHP, I have used mySQL a lot in the past for wordpress and other things, but for whatever reason this DB only wants to work on the remote hosting, I am at a loss and its been nothing but a headache from day one, if anyone could VC with me or are able to fix it I would be happy to compensate, this is a free side project I do and I am starting to really loose my mind.

Nah if they’re using MySQL and you do a dump you can import the database file anywhere.

Depending on how the website was designed it might require tweaking on the connection environment variables.

1 Like

yes, the problem is when I change it to connect to the local DB after dumping, using the same username and password(for testing of course) it refuses to insert to the DB,

I have had a few friends load the DB’s themselves and add the user and we all get the same result of it not being able to insert…

Did you remember to flush the privileges after altering the permissions?

Yes sir,

Grant all on mydb.* For 'user';
Flush privileges;

Something like that

Yup,
CREATE USER ‘newuser’@‘localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON * . * TO ‘newuser’@‘localhost’;
FLUSH PRIVILEGES;

Hmm interesting.

If you have a sql dump of the DB could you provide the metadata?

head myfile.sql

there’s two databases, one is a NAV database and the other is for flight plans, do you want both ?

Yes please. It helps tell us about the versions in use.

Do you have a mock environment?

OK i will try to give a short run down, the website uses discord oath for login,

so making a dev vps and a prod vps is just slightly out of my skill set so i usually just wait till about this time of night to mess around with it and do it live, (dumb i know)

i have a dedicated server with ovh and have pfsense as the firewall for it using vmware,

using deb 10 vps

Linux strips 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29) x86_64 GNU/Linux

-- MariaDB dump 10.17  Distrib 10.4.13-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 192.x.x.x    Database: k********tc
-- ------------------------------------------------------
-- Server version       10.2.31-MariaDB-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
-- MariaDB dump 10.17  Distrib 10.4.13-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 192.x.x.x.x   Database: k******nav
-- ------------------------------------------------------
-- Server version       10.2.31-MariaDB-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

I edited your dump with code formatting.

Sweet looks like they’re the same version, and a recent version.

1 Like

Unfortunately, I need to go to sleep now.

I’ll take another crack at this tomorrow.

Last thing I can think of is to try and log in with the user creds to see if it still display the same issue. I’m a rhel guy but there should be a global my.cnf file in /etc to poke around to see if you have any global settings which might be messing with you.

confused what you mean exactly there, but i will poke around…

Good morning, I am ready to assist.

1 Like

Good morning

Could you post a screenshot of the error?

I want to see the issue unfold in action.

Would it be possible for you to post a code snippet of the php in question for line 129 of controller.php?