Database rescue on Virtualmin

SYSTEM INFORMATION
OS type and version Debian 11
Virtualmin version 7.10.0

Hello,

Something went wrong when updating from Debian 10 to Debian 11. I used Virtualmin to manage the server (VS).
I was able to restore a lot of data via backups on a new server, but I didn’t have a backup for one domain. I can access the data on the old server and see the Mysql files in the var->lib->mysql folder (.frm, .idb).

I tried to copy the data to the new one but I get the error message:
SQL show index from xy_categorymeta failed : Table ‘abc.xy_categorymeta’ doesn’t exist in engine

I tried to dump the Database via ssh on the old server but it doesn´t work:
mysqldump: Got error: 2002: “Can’t connect to local MySQL server through socket ‘/run/mysqld/mysqld.sock’ (2)” when trying to connect

Is there a way to get this data on the new server?

Thank you

Your database isn’t “on Virtualmin”. Virtualmin is just providing a GUI. Working with the database is the same as for any other system.

You need to get it running on the old system so you can dump it for restore on a new system, or you need to replicate the version on another system and copy the binary data over.

I would recommend you figure out why MySQL won’t start, so you can perform a dump. That’s the easiest way to get data that you can copy to another system reasonably easily/safely.

That is not going to work. You can’t just copy file tables from a database from one system to the other, you need to create a proper export file that contains your entire database information. If the old server is running, must use the MySQL tools to export the database in a proper file format, then import it on the new server. Or if virtualmin is still running, you can also make the backup dump from the web interface.

The error you get means it’s configured to run authentication as login, not socket. Try first this on the old server and see the result:
mysql -u root -p

You should get a response asking for a password.

Thanks for the answers. The old server no longer works, I can only access it via SSH or FTP. I tried to start dump but that doesn’t work. I think the system is broken, when updating Debian, the update ended with an error.
The status of mariadb ist: Active: active (exited). I stopped it, restarted it… doesn’t work
Is there a way to install the system over it without losing data?

So what error soes mysql give you when it fails to start ? Try

service mysql status

Or use journalctl to get the similar result and post it here

mysql status:

● mariadb.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mariadb; generated)
Active: active (exited) since Sun 2024-07-14 13:59:15 CEST; 1 day 6h ago
Docs: man:systemd-sysv-generator(8)
Process: 35763 ExecStart=/etc/init.d/mariadb start (code=exited, status=0/S>

Jul 14 13:59:15 v32911.1blu.de systemd[1]: Starting LSB: Start and stop the mys>
Jul 14 13:59:15 v32911.1blu.de systemd[1]: Started LSB: Start and stop the mysq>
lines 1-8/8 (END)

an for mysqldump -u root -p --all-databases > backup.sql:

mysqldump: Got error: 2002: “Can’t connect to local MySQL server through socket ‘/run/mysqld/mysqld.sock’ (111)” when trying to connect

Try to start mysql with

service msql start && service mysql status

And see if the output changes, you will always get an error from mysqldump if mysql is not running, we have to work out why mysql is not running, last time I came across this the error was too many listen statements in config files. It maybe worth looking through them for duplicate listen statements

This is the error message:

Failed to start msql.service: Unit msql.service not found.

That means it still works.

I think there was a small typo, noticemsql

service mysql start && service mysql status

The curse of mobile phones :no_mobile_phones: !

1 Like

I think it’s hopeless. I already spent it and simply recreated the missing websites.