可可熊的窝

Tag Archives: MySQL

处理了下网站

IN:Linux   Tags: , ,    Comments:4

改了info域名后网站以前里很多页面里有cocobear.cn,连一些图片也显示不出来,今天就处理了一下:

把网站里一些文件做替换,先备份一下:
grep cocobear.cn ./cocobear.info/ -R -l –binary-files=without-match|xargs -i cp –parents {} bk/

然后全部替换:
grep cocobear.cn ./cocobear.info/ -R -l –binary-files=without-match | xargs sed -i ‘s/cocobear\.cn[^@]/cocobear\.info/g’

剩下就是数据库里的内容了,主要是wp_posts表中的post_content字段,还有guid字段,还有wp_comments中的comment_author_url,wp_postmeta中的meta_value;
操作的命令是:
mysql> update wp_posts set post_content=replace(post_content,”http://www.cocobear.cn”,”http://cocobear.info”);

当然在进行数据库操作时一定要记得先备份一下:
mysqldump -h mysql.1g50.cn -u cocobear -p cocobear > 0808151.sql

使用 mysqldump -h mysql.1g50.cn -u cocobear -p cocobear < 0808151.sql恢复似乎不太好,还是进mysql里使用source ~/0808151.sql进行恢复。

08-15
2008

F7中启动Mysql出错

IN:Linux   Tags: ,    Comments:6

F7在默认安装Mysql后启动时会出错:

使用mysqld_safe启动:

[cocobear@cocobear mysql]$ sudo mysqld_safe
nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/lib/mysql/cocobear.pid
070725 09:27:34 mysqld ended

使用service启动:

[cocobear@cocobear mysql]$ sudo service mysqld start
Timeout error occurred trying to start MySQL Daemon.
启动 MySQL: [失败]

这种情况下mysql.log出错提示为:

070725 09:28:59 mysqld started
070725 9:28:59 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: ‘open’.
InnoDB: Cannot continue operation.
070725 09:28:59 mysqld ended

根据日志文件的出错信息大致可以认定为权限问题,修改/var/lib/mysql/下的这几个文件权限:
ibdata1 ib_logfile0 ib_logfile1

[cocobear@cocobear mysql]$ sudo chmod 766 ib*

然后重新启动:

[cocobear@cocobear mysql]$ sudo service mysqld start
启动 MySQL: [确定]

很奇怪为什么会产生这样的问题,纳闷~

07-25
2007
loading...