Skip to content

Monthly Archives: April 2008

解决不能通过mysql.sock连接MySQL问题

22-Apr-08

这个问题主要提示是,不能通过’/tmp/mysql.sock’连到服务器,而php标准配置正是用过’/tmp/mysql.sock’,但是一些 mysql安装方法将mysql.sock放在/var/lib/mysql.sock或者其他的什么地方,你可以通过修改/etc/my.cnf文件来 修正它,打开文件,可以看到如下的东东:
[mysqld]
socket=/var/lib/mysql.sock
改一下就好了,但也会引起其他的问题,如mysql程序连不上了,再加一点:
[mysql]
socket=/tmp/mysql.sock
或者还可以通过修改php.ini中的配置来使php用其他的mysql.sock来连,这个大家自己去找找
或者用这样的方法:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
还有:
phpmyadmin的说明书有说
The error message “Warning: MySQL Connection Failed: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (111)…” is displayed. What can I do?
For RedHat users, Harald Legner suggests this on the mailing list:
On my RedHat-Box the socket of mysql is /var/lib/mysql/mysql.sock. In your php.ini you will find a line
mysql.default_socket [...]

MySQL修改root密码的多种方法

21-Apr-08

方法1: 用SET PASSWORD命令
mysql -u root
mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(’newpass’);
方法2:用mysqladmin
mysqladmin -u root password “newpass”
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass “newpass”
方法3: 用UPDATE直接编辑user表
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD(’newpass’) WHERE user = ‘root’;
mysql> FLUSH PRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe –skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD(”new password”) WHERE user=’root’;
mysql> FLUSH PRIVILEGES;
中文关键字:mysql 命令 vi pr 密码 多种 [...]

Apache的启动脚本

21-Apr-08

Apache的启动脚本

一般情况,如果是手动编译LAMP的话,一般情况下apache是没有启动脚本的,也就是说用户不能通过简单的
/etc/init.d/httpd start/stop/restart来启动/关闭/重新启动

其实在源码里已经有启动的脚本,我们要修改下即可,把Apache加入系统SysV服务中来。

在源码httpd-2.x.x/build/rpm中存在httpd.init

cp httpd.init /etc/init.d/httpd

vim /etc/init.d/httpd

#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the “License”); you may not use this file except [...]

linux下重新启动Apache的命令

21-Apr-08

/etc/init.d/httpd restart 重启
/etc/init.d/httpd start 启动
/etc/init.d/httpd stop 停止
/usr/local/apache2/bin/apachectl -k restart
userads(1)ad.userads.info/ads.js(1)中文关键字:linux 命令 apache 重新 httpd init restart etc apachectl local start stop bin usr

linux常用进程管理命令

21-Apr-08

ps 查看正在运行的程序
选项
-A 或 -e 显示所有进程
-l 长格式显示,可查看各个进程的优先权值
-u 显示指定用户的进程,比如 ps -u azalea
kill PID 终止进程
note: 终止前台进程是Ctrl+C 暂停前台进程是Ctrl+Z
& 使进程在后台运行
python helloworld.py &
bg 把前台进程转移到后台
Ctrl+Z
bg 1
fg 把后台进程转移到前台
fg PID

中文关键字:linux 命令 用户 进程 常用 管理 前台 后台 ctrl 转移 运行 优先权 helloworld pid 正在