Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
[ 2009/02/22 22:52 | by selboo ]
启动mysql 报错:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
1、先查看 /etc/rc.d/init.d/mysqld status 看看mysql是否已经启动.
另外看看是不是权限问题.
2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock
3、试试:service mysqld start
4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql
[root@localhost ~]# /etc/init.d/mysqld start
启动 MySQL: [ 确定 ]
[root@localhost ~]# mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
原因是,/var/lib/mysql 的访问权限问题。
shell> chown -R mysql:mysql /var/lib/mysql
接着启动服务器
shell> /etc/init.d/mysql start
服务器正常启动后察看 /var/lib/mysql 自动生成mysql.sock文件。
但是我的问题仍然没有得到解决。
问题终于解决:
方法: 修改/etc/my.conf:
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/usr/local/mysql
If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:
[client]
socket=/var/lib/mysql/mysql.sock
发现依旧如此,运行/etc/init.d/mysql start报错:Starting MySQLCouldn't find MySQL manager or server
是mysqld服务没启,运行/usr/local/mysql/bin/mysqld_safe &
问题解决。
執行 PHP 時出現類似這樣的錯誤訊息:
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9
請將 /tmp/mysql.sock link 到 /var/lib/mysql 目錄裡即可:
linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
1、先查看 /etc/rc.d/init.d/mysqld status 看看mysql是否已经启动.
另外看看是不是权限问题.
2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock
3、试试:service mysqld start
4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql
[root@localhost ~]# /etc/init.d/mysqld start
启动 MySQL: [ 确定 ]
[root@localhost ~]# mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
原因是,/var/lib/mysql 的访问权限问题。
shell> chown -R mysql:mysql /var/lib/mysql
接着启动服务器
shell> /etc/init.d/mysql start
服务器正常启动后察看 /var/lib/mysql 自动生成mysql.sock文件。
但是我的问题仍然没有得到解决。
问题终于解决:
方法: 修改/etc/my.conf:
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/usr/local/mysql
If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:
[client]
socket=/var/lib/mysql/mysql.sock
发现依旧如此,运行/etc/init.d/mysql start报错:Starting MySQLCouldn't find MySQL manager or server
是mysqld服务没启,运行/usr/local/mysql/bin/mysqld_safe &
问题解决。
執行 PHP 時出現類似這樣的錯誤訊息:
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9
請將 /tmp/mysql.sock link 到 /var/lib/mysql 目錄裡即可:
linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
linux多线程下载工具
[ 2009/02/22 22:43 | by selboo ]
from:http://badb0y.cublog.cn
前两个比较好用,推荐使用!
http://myget.sourceforge.net/
wget http://myget.sourceforge.net/release/myget-0.1.2.tar.gz
tar -zxvf myget-0.1.2.tar.gz
cd myget-0.1.2
./configure
make;make isntall
/usr/local/bin/mytget -n 10 -f mysql-5.0.22.tar.gz http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz
wget http://wilmer.gaast.net/downloads/axel-1.0b.tar.gz
tar -zxvf axel-1.0b.tar.gz
cd axel-1.0b
./configure
make;make install
/usr/local/bin/axel -n 10 http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz
/usr/local/bin/axel -n 10 -q http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz 安静
lftp -c "pget -n 10 http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz"
前两个比较好用,推荐使用!
http://myget.sourceforge.net/
wget http://myget.sourceforge.net/release/myget-0.1.2.tar.gz
tar -zxvf myget-0.1.2.tar.gz
cd myget-0.1.2
./configure
make;make isntall
/usr/local/bin/mytget -n 10 -f mysql-5.0.22.tar.gz http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz
wget http://wilmer.gaast.net/downloads/axel-1.0b.tar.gz
tar -zxvf axel-1.0b.tar.gz
cd axel-1.0b
./configure
make;make install
/usr/local/bin/axel -n 10 http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz
/usr/local/bin/axel -n 10 -q http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz 安静
lftp -c "pget -n 10 http://autosetup1.googlecode.com/files/mysql-5.0.22.tar.gz"
linux下脚本实现自动ftp
[ 2009/02/18 20:44 | by selboo ]
建立一个文本文件,例如文件名是ftp.txt,其内容如下:
open 192.168.1.50 /*用open连接远程服务器192.168.1.50*/
user MYNAME MYPASSWORD /*MYNAME是用户名,MYPASSWORD是密码*/
binary /*以二进制传送*/
hash /*当有数据传送时,显示#号*/
cd REMOTE_PATHNAME /*进入远程目标路径REMOTE_PATHNAME*/
get REMOTE_FILE LOCAL_FILE /*把远程文件REMOTE_FILE下载成本地文件LOCAL_FILE*/
put LOCAL_FILE REMOTE_FILE /*将本地文件LOCAL_FILE上传成远程文件REMOTE_FILE */
bye /*退出ftp应用*/
执行命令:
cat ftp.txt | ftp -n
open 192.168.1.50 /*用open连接远程服务器192.168.1.50*/
user MYNAME MYPASSWORD /*MYNAME是用户名,MYPASSWORD是密码*/
binary /*以二进制传送*/
hash /*当有数据传送时,显示#号*/
cd REMOTE_PATHNAME /*进入远程目标路径REMOTE_PATHNAME*/
get REMOTE_FILE LOCAL_FILE /*把远程文件REMOTE_FILE下载成本地文件LOCAL_FILE*/
put LOCAL_FILE REMOTE_FILE /*将本地文件LOCAL_FILE上传成远程文件REMOTE_FILE */
bye /*退出ftp应用*/
执行命令:
cat ftp.txt | ftp -n
华夏黑客同盟论坛-被黑
[ 2009/02/16 23:44 | by selboo ]
![点击在新窗口中浏览此图片 点击在新窗口中浏览此图片](attachment/1234799016_88419022.jpg)
以下是官方回复
黑客大部分是兴趣驱使,今天对我们网站是很特别的日子。再在感谢广大黑客朋友对我们的支持,对我们网站的鞭策,今后我们将加大力气加强各方面的密码安全,信息安全更上一层楼。
请广大会员放心,此次故障只是域名劫持,大家的密码信息,相关保密信息并没有泄密。
现在需要时间将域名更正被污染的DNS记录。正式恢复可能还要几个小时才能完成。
这些故障是一种攻击行为,也不能算是入侵,是黑客对网站的一种攻击手段。
本文来自: 华夏黑客同盟论坛 本文详细地址:http://bbs.77169.com/read.php?tid=243766
Linux 时间命令
[ 2009/02/16 21:01 | by selboo ]
Linux中的时间和时区
格林威治时间(GMT Greenwich Mean Time)是我们常提到的, 它也就是0时区时间. 但是我们在计算机中经常看到的是UTC. 它是Universal Time Coordinated的简写. 虽然可以认为UTC和GMT的值相等(误差相当之小),但是UTC已经被认定为是国际标准,所以我们都应该遵守标准只使用UTC.假如现在中国当地的时间是晚上8点的话,我们可以有下面两种表示方式:20:00 CST和12:00 UTC,这里的CST是Chinese Standard Time,也就是我们通常所说的北京时间了. 因为中国处在UTC+8时区,依次类推那么也就是12:00 UTC了.时区的另一个概念问题请看:http://bldmickey.blog.sohu.com/52743243.html
设置Linux Time Zone
在Linux下glibc提供了我们事先编译好的许多timezone文件, 他们就放在/usr/share/zoneinfo这个目录下。
设置时区的方式:
[root@localhost ~]# ln -sf /usr/share/zoneinfo/posix/Asia/Shanghai /etc/localtime
修改/etc/sysconfig/clock文件,例如:
[root@localhost ~]# cat /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=false
ARC=false
设置TZ环境变量的值
TZ的值可以有多种格式,最简单的设置方法就是使用tzselect命令,或者设置TZ环境变量
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
[root@localhost ~] #date
Thu Sep 20 17:40:08 CST 2007
修改系统时间
语法:date -s "dd/mm/yyyy hh:mm:ss"例如:
date -s 20090216 设置成2009年2月16日,这样会把具体时间设置成空00:00:00
date -s 20:04:12 设置具体时间,不会对日期做更改
date -s "20:04:12 2007-09-09" 这样可以设置全部时间
Linux中的RTC和系统时钟
在一台计算机上我们有两个时钟:一个称之为硬件时间时钟(RTC),还有一个称之为系统时钟(System Clock)。硬件时钟是指嵌在主板上的特殊的电路, 它的存在就是平时我们关机之后还可以计算时间的原因。系统时钟就是操作系统的kernel所用来计算时间的时钟. 它从1970年1月1日00:00:00 UTC时间到目前为止秒数总和的值在Linux下系统时间在开机的时候会和硬件时间同步(synchronization),之后也就各自独立运行了。在一些虚拟机中经常会出现RTC和系统时钟不同步的情况。
[root@localhost ~]# hwclock -r [root@localhost ~] #读取当前硬件时间时钟(RTC),
Thu 20 Sep 2007 05:51:53 PM CST -0.445215 seconds
[root@localhost ~]# hwclock -w
[root@localhost ~]# hwclock -w or hwclock --systohc将系统时钟同步到RTC
设置Linux NTP Client
[root@localhost ~] # crontab -e
转换时间为时间戳
[root@localhost ~]# date +%s -d "20090216" 只填写日期.默认会把时间设置成00:00:00
1234713600
[root@localhost ~]# date +%s -d "20090216 19:54:19"
1234785259
转换时间戳为时间
[root@localhost ~]# date -d '19700101 UTC 1234713600 seconds'
2009年 02月 16日 星期一 00:00:00 CST
[root@localhost ~]# date -d '19700101 UTC 1234785259 seconds'
2009年 02月 16日 星期一 19:54:19 CST
格林威治时间(GMT Greenwich Mean Time)是我们常提到的, 它也就是0时区时间. 但是我们在计算机中经常看到的是UTC. 它是Universal Time Coordinated的简写. 虽然可以认为UTC和GMT的值相等(误差相当之小),但是UTC已经被认定为是国际标准,所以我们都应该遵守标准只使用UTC.假如现在中国当地的时间是晚上8点的话,我们可以有下面两种表示方式:20:00 CST和12:00 UTC,这里的CST是Chinese Standard Time,也就是我们通常所说的北京时间了. 因为中国处在UTC+8时区,依次类推那么也就是12:00 UTC了.时区的另一个概念问题请看:http://bldmickey.blog.sohu.com/52743243.html
设置Linux Time Zone
在Linux下glibc提供了我们事先编译好的许多timezone文件, 他们就放在/usr/share/zoneinfo这个目录下。
设置时区的方式:
[root@localhost ~]# ln -sf /usr/share/zoneinfo/posix/Asia/Shanghai /etc/localtime
修改/etc/sysconfig/clock文件,例如:
[root@localhost ~]# cat /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=false
ARC=false
设置TZ环境变量的值
TZ的值可以有多种格式,最简单的设置方法就是使用tzselect命令,或者设置TZ环境变量
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
[root@localhost ~] #date
Thu Sep 20 17:40:08 CST 2007
修改系统时间
语法:date -s "dd/mm/yyyy hh:mm:ss"例如:
date -s 20090216 设置成2009年2月16日,这样会把具体时间设置成空00:00:00
date -s 20:04:12 设置具体时间,不会对日期做更改
date -s "20:04:12 2007-09-09" 这样可以设置全部时间
Linux中的RTC和系统时钟
在一台计算机上我们有两个时钟:一个称之为硬件时间时钟(RTC),还有一个称之为系统时钟(System Clock)。硬件时钟是指嵌在主板上的特殊的电路, 它的存在就是平时我们关机之后还可以计算时间的原因。系统时钟就是操作系统的kernel所用来计算时间的时钟. 它从1970年1月1日00:00:00 UTC时间到目前为止秒数总和的值在Linux下系统时间在开机的时候会和硬件时间同步(synchronization),之后也就各自独立运行了。在一些虚拟机中经常会出现RTC和系统时钟不同步的情况。
[root@localhost ~]# hwclock -r [root@localhost ~] #读取当前硬件时间时钟(RTC),
Thu 20 Sep 2007 05:51:53 PM CST -0.445215 seconds
[root@localhost ~]# hwclock -w
[root@localhost ~]# hwclock -w or hwclock --systohc将系统时钟同步到RTC
设置Linux NTP Client
[root@localhost ~] # crontab -e
转换时间为时间戳
[root@localhost ~]# date +%s -d "20090216" 只填写日期.默认会把时间设置成00:00:00
1234713600
[root@localhost ~]# date +%s -d "20090216 19:54:19"
1234785259
转换时间戳为时间
[root@localhost ~]# date -d '19700101 UTC 1234713600 seconds'
2009年 02月 16日 星期一 00:00:00 CST
[root@localhost ~]# date -d '19700101 UTC 1234785259 seconds'
2009年 02月 16日 星期一 19:54:19 CST