日期:2014-05-16  浏览次数:20735 次

MySQL-5.5.11 源码安装记录
操作系统:ubuntu 11.04

、安装所需要系统库相关库文件


2、创建mysql安装目录
  # mkdir -p /usr/local/mysql/
4、创建用户和用户组与赋予数据存放目录权限
  # groupadd mysql
  # useradd -g mysql mysql
  # chown mysql.mysql -R /service/mysql/
5、安装cmake(mysql5.5以后是通过cmake来编译的)
  # wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
  # tar zxvf cmake-2.8.4.tar.gz
  # cd cmake-2.8.4
  #./configure
  # make && make install


初始工具:gcc,cmake,make

增加用户组和用户

shell> sudo groupadd mysql

shell> sudo useradd -r -g mysql mysql

将压缩包.tar.gz解压缩到所需的目录

进入解压缩的目录

shell> sudo cmake .

安装遇到错误:

– MySQL 5.5.11

– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMake Error at cmake/readline.cmake:82 (MESSAGE):

Curses library not found. Please install appropriate package,



remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is libncurses5-dev ,

on RedHat and derivates it is ncurses-devel.

Call Stack (most recent call first):

cmake/readline.cmake:126 (FIND_CURSES)

cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

– Configuring incomplete, errors occurred!



下载工具libncurses5-dev,如果在RedHat 下是ncurses-devel。

下载之后先移除目录中的CMakeCache.txt

然后输入

shell> sudo cmake .



遇到警告:

Warning: Bison executable not found in PATHWarning: no usable bison found, /usr/src/mysql-5.5.11/sql/sql_yacc.yy will not be rebuilt.

下载工具:bison

下载之后先移除目录中的CMakeCache.txt

然后输入

shell> sudo cmake .



没有警告和错误发生,然后输入

shell> sudo make

shell> sudo make install

编译结束

shell> cd /usr/local/mysql

shell>sudo chown -R mysql .                               //修改mysql目录的所有者

shell> sudo chgrp -R mysql .                               //修改mysql目录的所有群组

shell> scripts/mysql_install_db --user=mysql   


cp support-files/my-medium.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

/etc/init.d/mysqld start

/usr/local/mysql/bin/mysql -u root -p

mysql>use mysql ;
mysql>update user set password=PASSWORD("bjsyx825") where user='root';
mysql>FLUSH PRIVILEGES;