Can't connect to database

You need to hire someone to fix your issues. No offense, but it is clear you have no clue what you’re doing. You’re jumping from one thing to another that isn’t remotely related to yet another that has nothing to do with what you said before.

Seriously: Hire a pro.

And of course, it did say it upgraded WordPress but when you go to the link, it errors out and says it can’t connect to the database.


Now installing WordPress version 5.8.1 …

WordPress initial installation complete. It can be completed at http://echohosting.net/wp-admin/upgrade.php.

… done

So this is the site I figured if I fixed it I can fix the rest. And again, it can’t connect to the database to finish the upgrade.

Hello @Gomez_Adams, I’ve sent @securewebs a private message with an offer to hire me to attempt to fix his systems. Just FYI.

1 Like

And @securewebs if you’re smart, you’ll take @calport offer. He’s very good at it. I’ve hired him before myself.

I agree. As I said before, I am not that good, or just good enough to get into trouble.

I don’t know about getting a private message from you… how do we get together?

To view private messages, scroll up to the top and tap your profile icon.

Are you sure the database is running?

Check with:

# systemctl status mysql

I recently noticed that the systemd unit for MySQL on Ubuntu is broken, and it sometimes fails to detect that MySQL didn’t actually start…the mysqld process is there, but it’s hung on a problem. In the case I was looking at MySQL couldn’t start because one of it’s databases was over quota and so it MySQL was getting disk full errors when starting. systemctl considered it “active” and showed green…but, no.

You could see when restarting it, however, and it would show that there were errors…so, restart mysql and watch for errors:

# systemctl restart mysql

And, regardless of whether you see errors there, or not, check the mysql log, which is, I think, somewhere in the /var/log/mysql/ directory. Probably called mysqld.log, or similar. I bet there are clues about why some or all databases aren’t working.

2021-09-24T23:01:38.840743Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user . Shutting down mysqld (Version: 8.0.26-0ubuntu0.20.04.2).
2021-09-24T23:01:40.322237Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.26-0ubuntu0.20.04.2) (Ubuntu).
2021-09-24T23:01:40.635926Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.26-0ubuntu0.20.04.2) starting as process 141215
2021-09-24T23:01:40.667514Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-09-24T23:01:40.960028Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-09-24T23:01:41.170925Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-09-24T23:01:41.171398Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-09-24T23:01:41.173964Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-09-24T23:01:41.174517Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-09-24T23:01:41.214150Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: ‘127.0.0.1’ port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-09-24T23:01:41.214156Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: ‘8.0.26-0ubuntu0.20.04.2’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306

OK, are you able to connect to MySQL using the CLI?

e.g.

# mysql -u <username> -p database-name

You’ll need the enter the password for whatever user you put after -u. Usually it’s a domain name, and the domain user’s password, but that’s not required.

If you can connect via the CLI, the problem is with the app, and you may find clues in the error_log for the domain in question (available in the GUI or in /var/log/virtualmin/domainname_error.log or similar).

Yes, no problem connecting to MySQL with CLI. I did a SHOW DATABASES; and got the expected list for that user. This is the same value I took from the WordPress config file. Again, I am not smart enough, or experienced enough to find a problem. So far all looks well. Thanks for the good suggestions.

There are no logfiles other than a small 12K file at /var/log/mysql/error.log. There are no logfiles at all under /var/log/virtualmin/ The snippet from above was from that small “error.log”.

How are there no log files there? That’s where Virtualmin sets up Apache to log both access and error logs, unless you configured it to do something different. And, the web server error log for the domain that’s having problems is the only way we’re going to solve this. We absolutely must see what error the web app is getting.

The web server is surely logging somewhere (and it’s supposed to be in /var/log/virtualmin, and you should have both an access log and error log viewer for each domain in Virtualmin itself). You can check the Apache config files in the vhost sections (in /etc/apache2/sites-available on ubuntu) for the error log and access log configured locations in ErrorLog and CustomLog directives. Every domain will have it’s own setting for this. You need to find those logs.

There is a small 62K error.log located at /var/log/apache2. The only thing I could spot of any interest in the file was the following: “PHP Warning: PHP Startup: Unable to load dynamic library ‘mysql.so’ (tried: /usr/lib/php/20190902/mysql.so (/usr/lib/php/20190902/mysql.so: cannot open shared object file: No such file or directory)”

It may mean nothing, mySQL is running. A new test WordPress install works. This new server has a different version of PHP than what the sites were using. Perhaps the problem is there, but I should think WordPress would be OK with a newer version. No activities reported in the control panel for any sites not working. In the past, this has always been my best bet to find something wrong. You check the Apache error files. Nothing to check as the sites not working are not creating log entries. At least I can’t find them if they are.

This is a fresh stock install of virtualmin. I have never fiddled with changing logfile locations or such. Why would I. I suppose I should consider building yet another new server and restoring just one of the sites not working to it. I am short on time for a few days but I will consider another new server build. I am trying to set it up for Niel Hirjee to take a peak at the machine to see if fresh eyes can spot something. It has not happened yet and the time zones are way different but I will let you know if he gets a chance to inspect the machine.

I think it probably means something if you know MySQL is running and you can connect via the command line, but you can’t connect with PHP clients and you see a PHP error about mysql.so!

That library path seems a little odd. Maybe look around to see where that library actually is, maybe an update happened and the config file didn’t change to match the new path? Also, I would think the newer mysql module would be used. (But, I’m dumb about PHP.)

The Indian consultant that I paid could not fix anything and for all I know, did absolutely nothing. So I just built another machine from scratch and that one works so far. Time will tell. If I have learned anything, it is that if I want to get something fixed, I have to teach myself how to do it as counting on someone else is a fools game.

Hi, I am the Indian consultant who ‘fixed nothing’ perhaps because you told me to leave the server alone after I informed you:

  1. what the problem was
  2. sought your consent to fix it
  3. offered, as an alternative solution, to reinstall Virtualmin and restore everything from backups at no extra charge (i.e this within the USD 50 that you had paid!)

However, as you are not satisfied with the outcome, I am refunding the amount that you have paid.

3 Likes

@calport he is somehow right here and he was the one telling you directly…some of your advice on this forums where dangerous and some was non logical and also bad, we are all humans. I understand, and you’re knowledgeable however, it seems to me you do not understand the decisions made once you offer past of your times seen this here and there with you. it’s okay, fella is looking for solution yes… leave it with virtualmin folks…

The customer is always right, @unborn. :slight_smile:

I have to ask what is the difference between a “consultant” and an “Indian consultant”. It sounds like something I should be aware of? Okay, I just looked it up. It is a “consultant” in both cases but my book says one term is used by a normal client and the other by an idiot client. Now I know.