Chinaunix首页 | 论坛 | 博客
  • 博客访问: 509629
  • 博文数量: 106
  • 博客积分: 1707
  • 博客等级: 上尉
  • 技术积分: 1109
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-16 11:24
个人简介

从事互联网开发、运营、设计、运维等工作。偏爱底层开发,服务器运维

文章分类

全部博文(106)

文章存档

2016年(3)

2015年(6)

2014年(5)

2013年(11)

2012年(8)

2011年(8)

2010年(34)

2009年(31)

分类: Mysql/postgreSQL

2010-05-31 15:42:14

基于,
http://blog.chinaunix.net/u3/106162/showart_2104365.html
http://blog.s135.com/nginx_php_v6/
http://hi.baidu.com/testgap/blog/item/6e6082ce48512137f9dc6164.html
参考以上四篇文章,十分感谢。

1、解压 tar -zxvf mysql-5.1.35-linux-i686-glibc23.tar.gz

2、做软连接
cd /usr/local
ln -s /usr/src/mysql-5.1.35-linux-i686-glibc23 /usr/local/mysql

3、groupadd mysql
   useradd -g mysql mysql
   mkdir -p /data/mysql/data
   mkdir -p /data/mysql/logs/binlog
   mkdir -p /data/mysql/logs/relaylog
   chown -R mysql:mysql /data/mysql/

4、cd /usr/local/mysql
   #scripts/mysql_install_db --user=mysql
   #/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql

   scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql

5、cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
   vi /etc/my.cnf 修改如下:

   basedir = /usr/local/mysql
   datadir = /data/mysql/data
   log-error = /data/mysql/logs/mysql_error.log
   pid-file = /data/mysql/mysql.pid

6、启动MySQL
   bin/mysqld_safe --user=mysql &

7、修改root密码
   bin/mysqladmin -uroot password 123456

8、bin/mysql -uroot -p #输入此命令后,会提示你输入root用户密码123456,

   show databases; #如果查出所有数据库,就恭喜你了

9、把mysql加入到系统服务中

   cp  /usr/local/mysql/share/mysql/mysql.server  /etc/init.d/mysqld      

   chkconfig --add  mysqld #加入到系统服务中,就可以通过service mysqld start|stop|status|restart等进行管理,很是方便,就不用再到/usr/local/mysql5.0.45/bin/启动mysql了 这一步没有成功,在share下面,没有找到mysql.server(希望看到的朋友帮忙解决,呵呵)

    解决办法:

    shell> cd /usr/local/mysql/ 
    shell> cp support-files/mysql.server /etc/init.d/mysql 
    shell> chmod 777 /etc/init.d/mysql  
    shell> chkconfig --add mysql 
    shell> chkconfig --level 35 mysql on

10、cp /usr/local/mysql/bin/mysql /usr/bin/mysql #把mysql常用的工具目录加入到系统变量目录中去,自己选择性加,这样做主要是可以直接运行该工具,而不需要切换到该目录下,类似于添加环境变量了

11、防火墙设置
service iptables stop
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables start















阅读(3433) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~