Backup MySql

Give permissions for every database to the backup user (you might not need lock tables).

GRANT SELECT, LOCK TABLES ON *.* 
     TO backupuser@host IDENTIFIED BY 'password';
dbUser=
dbHost=
dbPass=
 
for db in $(mysql --user=$dbUser --host=$dbHost \
                  --password=$dbPass -Bse 'show databases')
do
   backupFile=sql/$db.$(date +%F)-$(date +"%T").sql.gz
   mysqldump --add-drop-database --user=$dbUser \
             --host=$dbHost --password=$dbPass  \
             $db | gzip -9 > $backupFile
done

WordPress and MySQL

<?php
define('DB_NAME', 'username');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'sqlhost');
 
$table_prefix  = 'wp_';
 
$server = DB_HOST;
$loginsql = DB_USER;
$passsql = DB_PASSWORD;
$base = DB_NAME;
?>
CREATE DATABASE username;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
   ON username.* TO username@webhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;