MySQL编译安装详解

来源:互联网 发布:hp61墨盒清零软件 编辑:程序博客网 时间:2024/04/30 07:22


首先看gcc编译工具是否安装好了:

yum install -y gcc-*

相关rpm依赖包如下:

依赖包:
 libtermcap-2.0.8-46.1.x86_64.rpm 
 libtermcap-devel-2.0.8-46.1.x86_64.rpm 
 imake-1.0.2-3.x86_64.rpm 
 autoconf-2.59-12.noarch.rpm  
 automake-1.9.6-2.1.noarch.rpm 
 libtool-1.5.22-6.1.x86_64.rpm 
 m4-1.4.5-3.el5.1.x86_64.rpm 
 libstdc++-devel-4.1.2-44.el5.x86_64.rpm
 gcc-c++-4.1.2-44.el5.x86_64.rpm 
 zlib-devel-1.2.3-3.x86_64.rpm 
 ncurses-devel-5.5-24.20060715.x86_64.rpm
              


















编译安装MySQL5.1.50
[root@xen_202_14 install]# useradd mysql

[root@xen_202_14 install]# pwd
/tmp/install
[root@xen_202_14 install]# ll
total 23224
-rw-r--r-- 1 root root 23750564 Mar  4 09:51 mysql-5.1.50.tar.gz

[root@xen_202_14 install]# tar -xzvf mysql-5.1.50.tar.gz 

[root@xen_202_14 install]# ll
total 23228
drwxrwxrwx 33 7155 wheel     4096 Mar  4 11:07 mysql-5.1.50
-rw-r--r--  1 root root  23750564 Mar  4 09:51 mysql-5.1.50.tar.gz

[root@xen_202_14 mysql-5.1.50]#./configure  --prefix=/usr/local/mysql --datadir=/data/mysql/data --enable-assembler --with-client-ldflags=--all-static --with-unix-socket --with-charset=utf8 --enable-thread-safe-client --with-pthread --without-debug --with-big-tables --enable-community-features --enable-profiling --enable-local-infile --with-fast-mutexes --with-plugins=partition,federated,ndbcluster,innobase,csv,blackhole,myisam,innodb_plugin

[root@xen_202_14 mysql-5.1.50]# make 

[root@xen_202_14 mysql-5.1.50]# strip sql/mysqld

[root@xen_202_14 mysql-5.1.50]# make install

[root@xen_202_14 mysql-5.1.50]# cp support-files/my-medium.cnf /etc/my.cnf       
                                           #/etc/my.cnf 文件中的参数据实际情况而定
[root@xen_202_14 mysql-5.1.50]# cp support-files/mysql.server /etc/init.d/mysqld  
       #修改/etc/init.d/mysqld 文件中的"datadir"参数值为/data/mysql/data(datadir=/data/mysql/data)

[root@xen_202_14 mysql-5.1.50]# chmod u+x /etc/init.d/mysqld

[root@xen_202_14 mysql-5.1.50]# chkconfig --add mysqld (chkconfig中无此项服务时执行)

[root@xen_202_14 mysql-5.1.50]# /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/data/mysql/data

[root@xen_202_14 mysql-5.1.50]# chown -R mysql.mysql /data/mysql/

[root@xen_202_14 mysql-5.1.50]# service  mysqld start

[root@xen_202_14 mysql-5.1.50]# /usr/local/mysql/bin/mysqladmin -u root password '123456'

[root@xen_202_14 mysql-5.1.50]# echo "PATH=\"/usr/local/mysql/bin:/data/bin/:\$PATH\"" >> /etc/profile

[root@xen_202_14 mysql-5.1.50]# export PATH="/usr/local/mysql/bin:/data/bin/:$PATH"

[root@xen_202_14 mysql-5.1.50]# mysql -uroot -p123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26287
Server version: 5.1.50-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> 

0 0