2014-03-05 11:56:45

java简单添加discuz用户

朋友需要这么个功能,非常简单的写了个。有用到的朋友自己加用户是否存在等判断、这里未做同步只是实现了下逻辑。Discuz直接插入到pre_ucenter_members(默认前缀pre,根据自己实际情况)。 import java.sql.Connection; import java.sql.DriverManager; import java.util.Date; import java.util.Random; import org.apache.commons.codec.digest.DigestUtils; public class Discuz { public String getRandomString(int length) { String base = "abcdefghijklmnopqrstuvwxyz0123456789"; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { int number = random.nextInt(base.length()); sb.append(base.charAt(number)); } retur

2013-12-11 15:16:51

MySQL 数据库日志切割脚本

出处: http://netkiller.github.io/ #!/bin/bash USER=backup PASS=SaJePoM6BAPOmOFOd7Xo3e1A52vEPE LOGDIR="/tmp/backup" DATADIR="/var/lib/mysql" LOG=mysql.log LOG_ERROR=mysql_error.log LOG_SLOW_QUERIES=slow.log SOCKET="/var/lib/mysql/mysql.sock" #Number of copies COPIES=30 SHARDING=$(date -d "yesterday" +"%Y-%m-%d") mkdir -p ${LOGDIR}/${SHARDING} while read logfile age do mv ${DATADIR}/$logfile ${LOGDIR}/${SHARDING} done << EOF ${LOG} ${LOG_ERROR} ${LOG_SLOW_QUERIES} EOF mysqladmin -u${USER} -p${PASS} --socket=${SOCKET} flush-logs find $LOGD

2013-12-05 11:25:06

MySQL异常关闭后无法启动:MySQL Daemon failed to start 解决方案(CentOS下)

今天MySQL数据库占内存过大,导致网站时常出现500错误,按以下步骤解决: 1. 尝试/etc/init.d/mysqld stop 无响应,只得ps -ef | grep mysql 然后kill掉两个相关的mysql进程 2. 尝试/etc/init.d/mysqld start 不成功,查看mysql日志 cat /var/log/mysqld.log,发现以下错误: Thread pointer: 0x0 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 0 thread_stack 0x40000 /usr/libexec/mysqld(my_print_stacktrace+0x29) [0x84f539] /usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3713] /lib64/libpthread.so.0(+0xf500) [0x7f85469cb500] The manual page at http://dev