mysql 编译安装详解_MySQL编译安装详解

首先看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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值