It should be as simple as
mysql -h localhost -D test -ppassword <<-RENAME || true
RENAME TABLE $table TO $table\_keep;
or you could put it in an if statement
if mysql -h localhost -D test -ppassword <<-RENAME
SQL queries can an are often written on several lines as they can easily get lengthy. So the newline character in SQL is just another form of whitespace and queries have to be terminated by a semi-colon (;).
So until you enter that ;, the query is not terminated and if you press Enter, mysql reminds you so by issuing a secondary prompt.
You've run in to this note from the MySQL documentation (see https://dev.mysql.com/doc/refman/8.0/en/select-into.html):
As of MySQL 8.0.17, the umask for file creation is 0640; you must have sufficient access privileges to manipulate the file contents. Prior to MySQL 8.0.17, the umask is 0666 and the file is writable by all users on the server host.
I've never used Freeradius, and I'm not a BSD expert. This answer just states the obvious based on the error reported in your output.
There's an error listed at the end of the output:
...queries.conf: Failed parsing expanded string:
...queries.conf: ^ Unknown module
From the MySQL documentation, it looks like mysql_multi should not be used anymore:
Because systemd has the capability of managing multiple MySQL
instances on platforms for which systemd support is installed,
mysqld_multi and mysqld_multi.server are unnecessary and are not
installed. This is true as of MySQL 5.7.13 for RPM platforms, 5.7.19