Backup wordpress with non-ynh-default database name?

I have searched the forum for similar issues

on

This category is for issues regarding specific apps, NOT general issues with YunoHost.

on

This form is written in English :uk: but feel free to write in French :fr: if you’re more comfortable!

on

What type of hardware are you using

Other ARM board

What YunoHost version are you running

11.2.30.2

What app is this about

wordpress

Describe your issue

When i try to backup my wordpress app, i receive the error below. my wordpress install doesn’t use db name ‘wordpress’ (it was copied over from another non-ynh system), it has its own name.

is there a way to tell the backup scripts the name of my wordpress database?

Share relevant logs or error messages

mysqldump: Got error: 1049: “Unknown database ‘wordpress’” when selecting the database

Do you have the password for the WordPress database? Just move the current one to the standard WordPress database

i would like to not have to modify my wordpress install if possible.

i don’t understand why a db name would be hard-coded in a backup script? can’t it be fetched from the wp-config.php or similar?

you don’t want to change all the scripts install, remove, backup, restore, change-url of the package maintained and there the db has a name, a user and a password saved in the settings of the app. There are not a variables
 But you can install a wordpress, drop the database and import a db with mysql in the wordpress db


If you do not wish to modify your wordpress installation, why was the database name changed from the default? What benefit does the non-default database name provide?

my short-term suggestion is to just to copy the file somewhere. I’d give an example but I know neither the modified database name, nor the path to it.

Yunohost is supposed to make it easier for a user to manage a server so he doesn’t have to worry about certificates, databases, nginx configuration, backup, restore, upgrade. So it’s better to stick with what the scripts provide.
In your case, making custom changes requires to manage all the processes yourself and that’s not what you want when choosing yunohost to manage your server.
To get your problem solved, you have to make your app installation standard so the backup, restore would be easy.
Install phpmyadmin, export your database, open the database named WordPress, drop everything, import the database you exported.
Before you start you need the database password stored in yunohost settings, so run sudo yunohost app setting wordpress db_pwd. This will show you the password for the WordPress database.
Open the WordPress config file using :
sudo yunohost app shell wordpress
Then nano wp-config.php
Change the database name to wordpress and the database user to wordpress and the password you got from the previous command.
Save it and check your website is working fine by opening a private tab (so your browser doesn’t use the cache).
Now try running the backup script from the webadmin.
Good luck :crossed_fingers:

1 Like

as i already mentioned, it wasn’t changed from the default, the WP site was migrated from another host. it doesn’t provide any benefit, it just is different.

1 Like

thanks for the extra details, the detailed details, that’s v helpful. i’ll give it a crack.

(i was just averse to messing with WP because it seems to break so easily.)