Postfix and LOCK tables

just found error in /var/log/messages and when I try to backup postfix database.

mail# mysqldump -upostfix -p postfix > postfix.sql
Enter password:
mysqldump: Got error: 1044: Access denied for user ‘postfix’@’localhost’ to database ‘postfix’ when using LOCK TABLES

checking user privileges using information_schema

mail# mysql -upostfix -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1473
Server version: 5.0.51a-log FreeBSD port:

mysql-server-5.0.51a

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> select * from `information_schema`.`USER_PRIVILEGES`;

+———————–+—————+————-

—+————–+
| GRANTEE               | TABLE_CATALOG |

PRIVILEGE_TYPE | IS_GRANTABLE |
+———————–+—————+————-

—+————–+
| ‘postfix’@’localhost’ | NULL          | USAGE       

  | NO           |
+———————–+—————+————-

—+————–+
1 row in set (0.00 sec)

mysql> exit

Bye

mail# mysql -uroot -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1479
Server version: 5.0.51a-log FreeBSD port:

mysql-server-5.0.51a

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> grant all privileges on *.postfix to postfix@localhost identified by ‘fxxxxxyyyyy8’ with grant option;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘postfix to postfix@localhost identified by ‘fxxxxxyyyy8′ with grant option’ at line 1

mysql> grant all privileges on *.* to postfix@localhost identified by ‘fxxxxxyyyyy8’ with grant option;

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mail# mysqldump -upostfix -p postfix > postfix.sql

Enter password:

mail# postfix reload

postfix/postfix-script: refreshing the Postfix mail system

Looks fine 🙂

Tags: