PLEASE HELP TO FIX: mysqli::real_connect(): (HY000/2002): No such file or directory

| SYSTEM INFORMATION||
|------------------------------|-------------------------------|
| OS type and version | Ubuntu 20.0.4 |
| Webmin version | 2.101 |
| Virtualmin version | 7.7 |
| Related packages | SSL Setting |

Hello.

Our website hasn’t been running since a while ago.

We have been receiving for a few hours when we try to connect to our web site, the following error:

SQLSTATEHY000 No such file or directory

AS you can see on the following screenshot:

AND WHEN WE TRY TO CONNECT TO OUR PHPMYADMIN, No such file or directory this (mysqli::real_connect(): (HY000/2002)) error as you can see here:

ALSO, WHEN WE TRY TO EDIT DATABASE ON VIRTUALMIN DATABASE, WE GET THIS ERROR:

However, our site online for about 2 months, was working until a while ago. BUT WEIRDLY, we have been completely unable to connect for a few hours.

We are disappointed because it is a brand new project that we are launching and we are still at our beginning. If in the long run, we have to be confronted with these problem people, then we might as well not move forward.

Is there any way to restore our Website site please without reinstalling it exactly how it was ???
Why and how to fix that DataBase error ???

MySQL or Mariadb (probably mariadb, but that depends on when you installed Virtualmin, on Ubuntu) is not running.

Try to start it, and see what errors you get.

systemctl restart mysql

Then check status:

systemctl status mysql

If it is running, your apps should be working again. If it is not running, you need to figure out why. Look at (and actually read) the messages on the status, and then also check the journal for the mysql unit.

journalctl --since=yesterday -u mysql

It returns us:

root@host:~# systemctl restart mysql
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

returns us:

root@host:# systemctl status mysql
● mariadb.service - MariaDB 10.3.38 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2023-08-13 02:09:22 CEST; 2min 9s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 261005 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"

Aug 13 02:09:20 host.w...klx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 13 02:09:22 host.w...klx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 02:09:22 host.w...klx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 13 02:09:22 host.w...klx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.

This returns us:

root@host:# journalctl --since=yesterday -u mysql
-- Logs begin at Sat 2023-08-12 02:35:36 CEST, end at Sun 2023-08-13 02:35:58 CEST. --
-- No entries --
root@host:#

PLEASE HELP BECAUSE PERSONNALY I’M SCARED.

You have mariadb. So look at that.

journalctl --since=yesterday -u mariadb

This returns us:

root@host:# journalctl --since=yesterday -u mariadb
-- Logs begin at Sat 2023-08-12 02:35:36 CEST, end at Sun 2023-08-13 02:42:10 CEST. --
Aug 12 23:33:28 host.w...lx.tech systemd[1]: Stopping MariaDB 10.3.38 database server...
Aug 12 23:33:31 host.w...lx.tech systemd[1]: mariadb.service: Succeeded.
Aug 12 23:33:31 host.w...lx.tech systemd[1]: Stopped MariaDB 10.3.38 database server.
Aug 12 23:33:31 host.w...lx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 12 23:33:33 host.w...lx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 12 23:33:33 host.w...lx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 12 23:33:33 host.w...lx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.
Aug 13 01:24:13 host.w...lx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 13 01:24:16 host.w...lx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 01:24:16 host.w...lx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 13 01:24:16 host.w...lx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.
Aug 13 01:29:55 host.w...lx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 13 01:29:58 host.w...lx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 01:29:58 host.w...lx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 13 01:29:58 host.w...lx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.
Aug 13 02:09:20 host.w...lx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 13 02:09:22 host.w...lx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 02:09:22 host.w...lx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 13 02:09:22 host.w...lx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.
Aug 13 02:30:28 host.w...lx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 13 02:30:32 host.w...lx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 02:30:32 host.w...lx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 13 02:30:32 host.w...lx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.
Aug 13 02:31:59 host.w...lx.tech systemd[1]: Starting MariaDB 10.3.38 database server...
Aug 13 02:32:01 host.w...lx.tech systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Aug 13 02:32:01 host.w...lx.tech systemd[1]: mariadb.service: Failed with result 'exit-code'.
Aug 13 02:32:01 host.w...lx.tech systemd[1]: Failed to start MariaDB 10.3.38 database server.
root@host:#

What’s next Please ???

OK, look in the mariadb logs in /var/log/mariadb (probably, I don’t have an Ubuntu system handy to look at).

If there’s nothing useful in the log(s), you’ll need to go through the steps provided by the MariaDB developers for troubleshooting.

/var/log/mariadb does not exist but /var/log/mysql exists and in it, we got:

root@host:/var/log/mysql# ls
error.log  error.log.1.gz
root@host:/var/log/mysql# nano error.log
  GNU nano 4.8                                                                              error.log
2023-08-13  1:24:14 0 [Note] Starting MariaDB 10.3.38-MariaDB-0ubuntu0.20.04.1 source revision c73985f2ce8a391582787f3e310a011c1a712bec as process 250908
2023-08-13  1:24:14 0 [Note] InnoDB: Using Linux native AIO
2023-08-13  1:24:14 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-08-13  1:24:14 0 [Note] InnoDB: Uses event mutexes
2023-08-13  1:24:14 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-08-13  1:24:14 0 [Note] InnoDB: Number of pools: 1
2023-08-13  1:24:14 0 [Note] InnoDB: Using SSE2 crc32 instructions
2023-08-13  1:24:14 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-08-13  1:24:14 0 [Note] InnoDB: Completed initialization of buffer pool
2023-08-13  1:24:14 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-08-13  1:24:14 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2023-08-13  1:24:14 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-08-13  1:24:14 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-08-13  1:24:14 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-08-13  1:24:14 0 [Note] InnoDB: 10.3.38 started; log sequence number 287024358; transaction id 217130
2023-08-13  1:24:14 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-08-13  1:24:14 0 [Note] Plugin 'FEEDBACK' is disabled.
SSL error: Unable to get private key from '/etc/mysql/mysql-ssl.key'
2023-08-13  1:24:14 0 [ERROR] Failed to setup SSL
2023-08-13  1:24:14 0 [ERROR] SSL error: Unable to get private key
2023-08-13  1:24:14 0 [ERROR] Aborting

2023-08-13  1:29:56 0 [Note] Starting MariaDB 10.3.38-MariaDB-0ubuntu0.20.04.1 source revision c73985f2ce8a391582787f3e310a011c1a712bec as process 253263
2023-08-13  1:29:56 0 [Note] InnoDB: Using Linux native AIO
2023-08-13  1:29:56 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-08-13  1:29:56 0 [Note] InnoDB: Uses event mutexes
2023-08-13  1:29:56 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-08-13  1:29:56 0 [Note] InnoDB: Number of pools: 1
2023-08-13  1:29:56 0 [Note] InnoDB: Using SSE2 crc32 instructions
2023-08-13  1:29:56 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-08-13  1:29:56 0 [Note] InnoDB: Completed initialization of buffer pool
2023-08-13  1:29:56 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-08-13  1:29:56 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2023-08-13  1:29:56 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-08-13  1:29:56 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-08-13  1:29:56 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-08-13  1:29:56 0 [Note] InnoDB: 10.3.38 started; log sequence number 287024367; transaction id 217130
2023-08-13  1:29:56 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-08-13  1:29:56 0 [Note] Plugin 'FEEDBACK' is disabled.
SSL error: Unable to get private key from '/etc/mysql/mysql-ssl.key'
2023-08-13  1:29:56 0 [ERROR] Failed to setup SSL
2023-08-13  1:29:56 0 [ERROR] SSL error: Unable to get private key
2023-08-13  1:29:56 0 [ERROR] Aborting

2023-08-13  2:09:20 0 [Note] Starting MariaDB 10.3.38-MariaDB-0ubuntu0.20.04.1 source revision c73985f2ce8a391582787f3e310a011c1a712bec as process 261005

WHAT’S WRONG THERE AND HOW TO CORRECT IT ???

This was discussed recently. It means TLS was enabled, but there isn’t a key for it. I don’t recall what triggers it, but Ilia posted a solution here: URGENT | MariaDB crashed after hitting "set as default services certificate" button - #48 by Ilia

Thanks again. But when following the solution posted here, I got this Unable to load Private Key like this:

root@host:# openssl rsa -in /etc/mysql/mysql-ssl.key -out /etc/mysql/mysql-ssl.key
unable to load Private Key
root@host:#

What’s is wrong again there ???
Why unable to load Private key ???

OR is there any way to regenerate SSL Certificate for Our DataBase or MySQL ???
Or are you think about another solution for me please ???

Do you a allow remote connections to MySQL/MariaDB (direct connections to the database from hosts other than the server itself…i.e. not local PHP apps, but some system outside of yours making a connection to MariaDB on port 3306)?

If not, just disable SSL/TLS unless/until you’re able to sort out the problem with the certificate.

Browse to Webmin->Servers->MariaDB Database Server->SSL Certificate

And, make it look like this:

i.e. disable TLS, by setting all the cert/key settings to “None set” and setting require clients use SSL to “No”.

Then restart MariaDB.

But I got here this error:

And when clicking on “Start MariaDB Server” button, I get another one:

Our website is already online. Please, any other help ???

You need to do the same thing you did above to find out why it’s failing now. I can’t guess.

Thinking about it, I think that problem appeared after generating a new Let’s Encrypt Wildcard SSL Certificat for one of Virtual Server and clicking on “Set as Default Services Certificate” circled in RED on the following Screenchot:

Isn’t there any way to make reset or cancel that “Setting as Default Services Certificate” ???

have a look at this it may help URGENT | MariaDB crashed after hitting "set as default services certificate" button - #17 by azbce

1 Like

Thanks for your answer but I don’t understant, it just return two images the link in your answer.

What, say axactly these both images AND how can they help me to resolve my problem ???

Please, can anyone explain me what is on this link: URGENT | MariaDB crashed after hitting "set as default services certificate" button - #17 by azbce ???

Keep scrolling. The two images are just one post in a long thread, where jimr1 explains another way to fix it (it’s the same solution I gave above, but using the command line…since doing it in Webmin didn’t work for reasons I can’t guess, might as well do it on the command line…since it will resolve your problem, if you disable SSL in MariaDB).

Thanks everyone. It help me.

1 Like

glad your up and running again