您的位置:首页 > 运维架构 > Linux

linux下mysql源码包安装-方法1

2011-12-07 11:00 447 查看
[root@mg04 opt]# tar zxvf libevent-1.4.13-stable.tar.gz

[root@mg04 opt]# cd libevent-1.4.13-stable
[root@mg04 libevent-1.4.13-stable]# ./configure --prefix=/usr/local/libevent
[root@mg04 libevent-1.4.13-stable]# make && make install
[root@mg04 libevent-1.4.13-stable]# ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /usr/lib
[root@mg04 opt]# tar zxvf mysql-5.1.49.tar.gz
[root@mg04 opt]# cd mysql-5.1.49
[root@mg04 mysql-5.1.49]# groupadd mysql
[root@mg04 mysql-5.1.49]# useradd -g mysql -s /sbin/nologin mysql
[root@mg04 mysql-5.1.49]# ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --localstatedir=/usr/database/mysql_data --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-mysqld-user=mysql --with-pthread --enable-thread-safe-client --with-extra-charsets=utf8,gbk --with-plugins=partition,innobase,myisammrg
[root@mg04 mysql-5.1.49]# make && make install
[root@mg04 mysql-5.1.49]# cp support-files/my-huge.cnf /etc/my.cnf
[root@mg04 mysql-5.1.49]# mkdir -p /usr/database/mysql_data
[root@mg04 mysql-5.1.49]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root@mg04 mysql-5.1.49]# chown -R root /usr/local/mysql/
[root@mg04 mysql-5.1.49]# chown -R mysql /usr/database/mysql_data/
[root@mg04 mysql-5.1.49]# chgrp -R mysql /usr/local/mysql/
[root@mg04 mysql-5.1.49]# /usr/local/mysql/bin/mysqld_safe &
[root@mg04 mysql-5.1.49]# cp support-files/mysql.server /etc/init.d/mysqld
[root@mg04 mysql-5.1.49]# chmod 755 /etc/init.d/mysqld
[root@mg04 mysql-5.1.49]# /etc/init.d/mysqld stop
Shutting down MySQL.....100712 23:19:20 mysqld_safe mysqld from pid file /mnt/database/mysql_data/mg04.jieshi.org.pid ended
[ OK ]
[2]- Done /mnt/software/mysql/bin/mysqld_safe
[root@mg04 mysql-5.1.49]# /etc/init.d/mysqld start
Starting MySQL. [ OK ]
[root@mg04 mysql-5.1.49]# /etc/init.d/mysqld restart
Shutting down MySQL.... [ OK ]
Starting MySQL. [ OK ]
[root@mg04 mysql-5.1.49]# vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
[root@data03 mysql-5.1.49]# source /etc/profile
[root@mg04 mysql-5.1.49]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.49-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
[root@mg04 mysql-5.1.49]# chkconfig mysqld on
[root@data03 opt]# chkconfig --level 24 mysqld off
[root@data03 opt]# chkconfig --list mysqld
mysqld 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭

[root@mg04 ~]# mysqladmin -uroot password dian588
[root@mg04 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.49-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
[root@mg04 opt]# tar zxvf memcached-1.4.5.tar.gz
[root@mg04 opt]# cd memcached-1.4.5
[root@mg04 memcached-1.4.5]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
[root@mg04 memcached-1.4.5]# make && make install
[root@mg04 ~]# /usr/local/memcached/bin/memcached -d -m 50 -u root -p 11211
[root@mg04 ~]# netstat -an |grep 11211
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN
tcp 0 0 :::11211 :::* LISTEN
udp 0 0 0.0.0.0:11211 0.0.0.0:*
udp 0 0 :::11211 :::*

[root@mg04 ~]# vim /etc/rc.local
/usr/local/memcached/bin/memcached -d -m 50 -u root -p 11211
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
clamav-0.96.1-1.el5.rf.i386.rpm libevent-1.4.13-stable.tar.gz
clamav-db-0.96.1-1.el5.rf.i386.rpm memcached-1.4.5
clamav-devel-0.96.1-1.el5.rf.i386.rpm memcached-1.4.5.tar.gz
clamd-0.96.1-1.el5.rf.i386.rpm mysql-5.1.49
libevent-1.4.13-stable mysql-5.1.49.tar.gz
[root@data03 opt]# rpm -ivh *.rpm
warning: clamav-0.96.1-1.el5.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:clamav-db ########################################### [ 25%]
2:clamav ########################################### [ 50%]
3:clamav-devel ########################################### [ 75%]
4:clamd ########################################### [100%]
[root@data03 opt]# /etc/init.d/clamd start
Starting Clam AntiVirus Daemon: LibClamAV Warning: **************************************************
LibClamAV Warning: *** The virus database is older than 7 days! ***
LibClamAV Warning: *** Please update it as soon as possible. ***
LibClamAV Warning: **************************************************
[确定]
[root@data03 opt]# chkconfig clamd on
[root@data03 opt]# chkconfig --level 24 clamd off
[root@data03 opt]# chkconfig --list clamd
clamd 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭
[root@data03 opt]# freshclam
[root@mg08 opt]# crontab -e
*/50 * * * * /usr/bin/freshclam --quiet --daemon
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: