Ubuntu 10.10 server 实践–mysql安装

十二 10 2010

今天开始用源码安装mysql,首先需要下载mysql的源码文件,然后解压,进入到解压后的目录
安装MySQL源码分发版的基本命令是:

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root  .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

mysql安装是依赖包ncurses,所以安装mysql前必须要要安装这个,否则会报错,大概信息是:
configure: error: No curses/termcap library found
解决的办法就是到如下地址http://ftp.gnu.org/pub/gnu/ncurses/,选择最新源码,然后解压执行./configure, make , make install安装完毕,安装ncurses不要设置prefix参数,否则可能出现不能正确查找到的情况。

注意:在make时,需要很长的时间,我用了大概半个小时
以下命令的工作目录都是基于/usr/local/mysql,请注意。
启动命令:

sudo bin/mysqld_safe --user=mysql &

停止命令:

sudo bin/mysqladmin shutdown

查看mysql版本:

sudo bin/mysqladmin version

查看mysql的状态:

sudo bin/mysqladmin pin

No responses yet

Leave a Reply

*