I am trying to back up all the WordPress related databases on the server, but I keep running into this particular error
I am storing all the WordPress databases in a variable name like so
> databases=$(mysql -u root -p --vertical --skip-column-names -e "SHOW DATABASES LIKE 'wp_%'" | grep -i wp | tr '\n' ' ')
> echo $database # now contains something like wp_1 wp_2 wp_3 ...
So in order to back up the databases, I am running this command
> mysqldump -u root -p --add-drop-database --add-drop-table --lock-tables --add-locks --add-drop-trigger --disable-keys --databases $databases > wordpress_databases.sql
But I am getting this error
mysqldump: Got error: 1102: Incorrect database name 'wp_1 wp_2 wp_' when selecting the database
What am I missing here?