2004年10月8日

Reminders in MySQL

1. Fix Chinese issue in MySQL
# vi /etc/my.cnf
// [myqld]
// default-character-set = big5
// [client]
// default-character-set = big5

2. Note port number while using mysql_real_connect()
// mysql_real_connect(&mysql, DB_IP, DB_USER, DB_PW, DB_NAME, DB_PORT, NULL, 0)
// DB_PORT=3306

3. To get the last day of every month
// (To_DAYS(DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH),\'%%Y-%%m-01\'))-TO_DAYS(DATE_FORMAT(CURDATE(),\'%%Y-%%m-01\')))

4. When configuring permission, the HOST field could be left as blank to prevent database connection failure.