Hi.. thanks for your reply... I did that but it did not help. However there is a silver lining.
One other change that I made, and which i overlooked; sorry about that, was the line below in the backup script:
Code:
# Username to access the MySQL server e.g. dbuser
USERNAME=root
# Username to access the MySQL server e.g. password
PASSWORD=myrootpassword
# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
DBNAMES="all"
# Backup directory location e.g /backups
# The meat of the script is here:
mysqldump --user=$USERNAME --password=$PASSWORD --host=$DBHOST $OPT $1 > $2
BACKUPDIR="/root/backup/mysqlbackup"
When the script was working fine, the line said:
DBNAMES="db1 db2 db3"
When I changed to
DBNAMES="all", it included another database 'db4'. Here is how I setup db4:
When I created this db, i created the following user to access the db:
mysql> create user 'userT'@'localhost' identified by '*****';
mysql> grant all on db4.* to 'userT'@'localhost';
Now, I did not give root the grant for db4. But isn't it that root by default has grant on every db created?
So I made a duplicate of my backup script and made the change like this:
Code:
# Username to access the MySQL server e.g. dbuser
USERNAME=userT
# Username to access the MySQL server e.g. password
PASSWORD=******
# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
DBNAMES="db4"
# Backup directory location e.g /backups
BACKUPDIR="/root/backup/mysqlbackup"
This time, the script runs fine. So the only thing I can think of is that root had full grant on db1, db2, db3 but not db4 and hence the error?
But when i do this:
Code:
mysql> show grants;
+---------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*******' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `db4`.* TO 'root'@'localhost' |
+---------------------------------------------------------------------------------------------------------------+
Doesn't the first line means that root has all privileges (*.*) on all db?
Thanks again for your insights