分类 运维技术 下的文章

有个用户的MySQL数据库表在phpMyAdmin中显示使用中,提示已经损坏
MySQL的错误日记提示:Table ‘xxx’ is marked as crashed and should be repaired

如果和野草主机一样服务器安装了phpMyAdmin,登入进去,选中有问题的表,滑倒网页底部,有“选中项”的,打开选项,点击“修复表”,即可修复。

1.显示最后20行

tail -n 20 文件名

如tail -n 20 log.txt

2.显示中间20,从1000开始

cat log.txt|tail -n +1000|head -n 20

注:tail -n +行号 意思为 从第多少行开始 ,如果是 tail -n -行 == tail -n 行 意思为文件末尾多少行的数据
head -n 20 前20行的数据

3.也可以用sed命令

如 sed -n '100,120p' log.txt 100 到120行的数据。

参考学习:http://www.cnblogs.com/tuozi001/archive/2013/01/10/2855617.html

[root@localhost ~]# service mysqld start
Another MySQL daemon already running with the same unix socket.
正在启动 mysqld: [失败]

尝试重启,出现如下错误

[root@localhost ~]# /etc/init.d/mysqld status
mysqld 已停

可以执行该命令修复

mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

参考:http://bbs.csdn.net/topics/390662731?page=1#post-396281623

vim /etc/csf/csf.conf
  
PORTFLOOD = "22;tcp;5;300,80;tcp;20;5"  

/etc/init.d/csf start  


解释:

1),如果300秒内有5个以上连接到tcp端口22的连接,则至少在发现最后一个数据包300秒后阻止该IP地址访问端口22,即在该阻止被取消前有300秒的"安静" 期。
2), 如果5秒内有20个以上连接到tcp端口80的连接,则至少在发现最后一个数据包5秒后阻止该IP地址访问端口80,即在该阻止被取消前有5秒的"安静" 期。

给我感觉是,csf不光有一面墙,墙后面,还有一张网,动态防御。感觉这一点做的比较好。


参考: http://blog.51yip.com/server/1503.html

下午在一台centos上折腾,用到mysql的时候发现root密码忘记了,很久没上了……
如果有centos root权限的话,可以尝试跳过验证修密码,具体操作如下。

(mysql如果是通过 yum 安装的,可以用 rpm -ql mysql (usr/bin) 查找安装路径)

# /etc/init.d/mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password:
mysql>

下载地址:http://pkgs.repoforge.org/p7zip/

CentOS 5.x 32位

# wget http://pkgs.repoforge.org/p7zip/p7zip-9.20.1-1.el5.rf.i386.rpm
# rpm -ivh p7zip-9.20.1-1.el5.rf.i386.rpm

CentOS 5.x 64位

# wget http://pkgs.repoforge.org/p7zip/p7zip-9.20.1-1.el5.rf.x86_64.rpm
# rpm -ivh p7zip-9.20.1-1.el5.rf.x86_64.rpm

CentOS 6.x 32位

# wget http://pkgs.repoforge.org/p7zip/p7zip-9.20.1-1.el6.rf.i686.rpm
# rpm -ivh p7zip-9.20.1-1.el6.rf.i686.rpm

CentOS 6.x 64位

# wget http://pkgs.repoforge.org/p7zip/p7zip-9.20.1-1.el6.rf.x86_64.rpm
# rpm -ivh p7zip-9.20.1-1.el6.rf.x86_64.rpm

参考: http://teddysun.com/176.html

以root登入,或者su root

# yum install "@Chinese Support"

完成安装后回到桌面进行设置:system -> preferences -> input method

附:在ibus-pinyin里使用搜狗词库

# wget http://hslinuxextra.googlecode.com/files/sougou-phrases-full.7z
# 7za x sougou-phrases-full.7z
# cp ibus/android.db /usr/share/ibus-pinyin/db/android.db
# 输入y确认覆盖

更新系统内核到最新

yum -y update

系统更新后,如果yum安装时提示错误信息,请执行以下命令修复.

rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*

安装Apache,PHP,MySQL,以及扩展

yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql