mlzboy 发表于 2013-1-28 16:53:00

在Ubuntu中通过源码安装编译安装软件(MySQL篇) 收藏

<h1>./configure --prefix=/usr/local/mysql \

--without-debug \

--without-bench \

--enable-thread-safe-client \

--enable-assembler \

--enable-profiling \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static \

--with-charset=utf8 \

--with-extra-charset=latin1,gbk \

--with-innodb \

--with-csv-storage-engine \

--with-federated-storage-engine \

--with-mysqld-user=mysql \

--without-embedded-server \

--with-server-suffix=-community \

--with-unix-socket-path=/usr/local/mysql/sock/mysql.sock

</h1>





编译参数

 
 
 
 
 






  在Ubuntu中通过源码安装编译安装软件(MySQL篇) 收藏

<div class="blogstory" style="float: left; width: 915px; font-size: 14px; line-height: 30px; font-family: verdana, sans-serif;">       使用Ubuntu Server作为本地测试环境已经有一段时间了,一直都是使用apt-get方式来安装各种应用软件,通过源码编译安装应用软件是Linux和Unix环 境下最常用的方式。通过源码编译安装的最大好处就是你知道自己做了什么,这种方式安装软件自由灵活,也适用于各种平台、维护方便;本系列文章都是在 Ubuntu Server系统的命令行模式下完成。
        在进行源码编译安装之前,我们首先需要作如下的准备工作:
1、更新您的Ubuntu
sudo apt-get update 
sudo apt-get upgrade
2、安装所需软件包
sudo apt-get install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev lynx m4 make ncftp nmap perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ build-essential 

apt-get可一次安装多个软件,以上安装可根据需要选装.在安装过程中可能会提示你插入Ubuntu的光盘.如果通过SSH远程管理Ubuntu出现乱码,不能正常查看汉字信息,请参考PuTTY连Ubuntu的SSH出现乱码的处理
3、安装libncurses5-dev
sudo apt-get install libncurses5-dev
通过源码编译安装软件时,出现错误信息:
checking for termcap functions library… configure: error: No curses/termcap library found
安装libncurses5-dev库方可解决.
今天首先介绍的是LAMP组中作为数据存储的MySQL的源码编译安装过程:
mysql使用utf-8作为默认编码: 
groupadd mysql 
useradd -g mysql mysql 
tar -zxvf mysql-5.0.45.tar.gz 
cd mysql-5.0.45 
./configure –prefix=/usr/local/mysql –with-charset=utf8 –with-collation=utf8_general_ci –with-extra-charsets=latin1 
make 
make install 
cp support-files/my-medium.cnf /etc/my.cnf
启动vim修改my.cnf文件
vim /etc/my.cnf
找到log-bin=mysql-bin这一行,将其注释掉:#log-bin=mysql-bin

cd /usr/local/mysql 
bin/mysql_install_db --user=mysql 
chown -R root . 
chown -R mysql /usr/local/mysql/var 
chgrp -R mysql .
启动MySQL:
bin/mysqld_safe --user=mysql & 



让mysql随系统一起启动:
使用vi编辑器,对/etc/rc.local文件进行编辑
vi /etc/rc.local
在exit 0前面加上
/usr/local/mysql/bin/mysqld_safe --user=mysql & 

重启服务器,验证mysql是否能随系统正常启动,启动后: 
mysql 
如果能直接进入则说明启动成功。 
为了安全,修改root密码: 
mysql>use mysql 
mysql>UPDATE user SET password=PASSWORD('new_password') WHERE user='root'; 
mysql>FLUSH PRIVILEGES; 
mysql>exit
页: [1]
查看完整版本: 在Ubuntu中通过源码安装编译安装软件(MySQL篇) 收藏