Category Archives: Database

Stop GAMMU smsd (27)

C:\gammu2>gammu –smsd MYSQL smsdrc
Log filename is “smsdlog”
Stop GAMMU smsd (27)

Fri 2008/06/06 11:06:10 : Stop GAMMU smsd (27)
Fri 2008/06/06 11:06:53 : Start GAMMU smsd
Fri 2008/06/06 11:06:53 : PIN code is “1234”
Fri 2008/06/06 11:06:53 : commtimeout=1, sendtimeout=10, receivefrequency=0, resetfrequency=0
Fri 2008/06/06 11:06:53 : deliveryreport = no
Fri 2008/06/06 11:06:53 : phoneid =
Fri 2008/06/06 11:06:53 : No table for sent sms: Table ‘sentitems’ is marked as crashed and should be repaired

Fri 2008/06/06 11:06:53 : Stop GAMMU smsd (27)

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\edp>cd c:\appserv\mysql\bin

C:\AppServ\MySQL\bin>mysql -uroot -p
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4607
Server version: 5.0.45-community-nt-log MySQL Community Edition (GPL)

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

mysql> use sms2;
Database changed
mysql> repair table sentitems;
+—————-+——–+———-+———-+
| Table          | Op     | Msg_type | Msg_text |
+—————-+——–+———-+———-+
| sms2.sentitems | repair | status   | OK       |
+—————-+——–+———-+———-+
1 row in set (0.05 sec)

mysql>

Don’t have idea why Table ‘sentitems’ is marked as crashed.

MySQL and Null

Just for my own record, dealing with Null type field.

Checking with :

select * from tablename where field1=”  -> this one not work

select * from tablename where field1=’Null’ -> same too

is null is the answer

select * from tablename where field1 is null

Save my day, thanks to St4r :-)

Mysql Trigger Tutorial and Tools

Deal with gammu and mysql make learn more about mysql feature in mysql 5.0 called trigger.

Books always good to start with so I choose MySQL Stored Procedure Programming book to start with but others might help to for someone looking for practical solution in cookbook form etc :

  1. High Performance MySQL: Optimization, Backups, Replication, and More
  2. MySQL Cookbook
  3. MySQL Stored Procedure Programming
  4. MySQL in a Nutshell (In a Nutshell (O’Reilly))
  5. MySQL Administrator’s Bible (Bible (Wiley))
  6. Understanding MySQL Internals

Looking around in google make me find some interesting links around trigger in mysql, here the list :

Wew, a lot of example but for deliver due project I’ll use cron. Once I get the point I’ll try out trigger :-)

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 :-)