/ 中存储网

MySQL 5.5.8安装过程以及遇到的问题解决方法

2014-07-13 15:43:45 来源:中存储网

首先到http://www.cmake.org/cmake/resources/software.html

cd /mysql
1.安装cmake
1)下载cmake
#wge thttp://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
2)解压cmake
#tar -zvxf cmake-2.8.3.tar.gz
3)配置编译
#cd cmake-2.8.3
#yum -y install gcc
#yum -y install gcc-c++
#./configure
#make
#make install

2.安装MYSQL
1)下载MYSQL
#cd /mysql
#wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.8.tar.gz/from/http://mysql.mirror.rafal.ca/
2)解压mysql-5.5.8.tar.gz
#tar -zvxf mysql-5.5.8.tar.gz

 创建数据目录(mysql5.5默认已经没有data目录了)

     mkdir /mysql/mysql/data
3)配置编译
#cd mysql-5.5.8
#cmake .                             ##这个方法,安装路径默认

#cmake .
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_INSTALL_PREFIX:PATH=/mysql/mysql
-DCOMMUNITY_BUILD:BOOL=ON
-DENABLED_PROFILING:BOOL=ON
-DENABLE_DEBUG_SYNC:BOOL=OFF
-DINSTALL_LAYOUT:STRING=STANDALONE
-DMYSQL_DATADIR:PATH=/mysql/mysql/data
-DMYSQL_MAINTAINER_MODE:BOOL=OFF
-DWITH_EMBEDDED_SERVER:BOOL=ON
-DWITH_EXTRA_CHARSETS:STRING=all
-DWITH_SSL:STRING=bundled
-DWITH_UNIT_TESTS:BOOL=OFF
-DWITH_ZLIB:STRING=bundled
-LH

如果出现一下错误:
cmake .
-- MySQL 5.5.8
-- 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!



安装:
# yum -y install ncurses-devel


#make

#make install

#groupadd mysql

#useradd -r -g mysql mysql

#cd /mysql/mysql
#chown -R mysql:mysql .
#scripts/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql data
#cp ./support-files/my-small.cnf ./my.cnf 
#cp support-files/mysql.server mysql; chmod +x mysql
#chown -R mysql:root .
#./mysql start
#./bin/mysqladmin -u root password

错误解决
1) ./scripts/mysql_install_db
      Installing MySQL system tables...
      101223 14:28:49 [ERROR] ./bin/mysqld: unknown option '--skip-locking'
      101223 14:28:49 [ERROR] Aborting
      101223 14:28:49 [Note] ./bin/mysqld: Shutdown complete
     由于是以前安装过mysql ,所以存在/etc/my.cnf,而且mysql的环境变量和现在的不一样,
     从而影响 现在的,解决方法是:rm -rf /etc/my.cnf

2 )  ./scripts/mysql_install_db --basedir/mysql/mysql/ --datadir/mysql/mysql/data/mysql  --user=mysql
 查看原因:cat data/xcw.err
     101223 15:39:18 mysqld_safe Starting mysqld daemon with databases from      /w/mysqld558/data
  /w/mysqld558/bin/mysqld: Table 'mysql.plugin' doesn't exist
  101223 15:39:18 [ERROR] Can't open the mysql.plugin table. Please run  mysql_upgrade to create it.
   InnoDB: The InnoDB memory heap is disabled
   InnoDB: Mutexes and rw_locks use InnoDB's own implementation
   InnoDB: Compressed tables use zlib 1.2.3
   101223 15:39:18  InnoDB: Using Linux native AIO
   101223 15:39:18  InnoDB: Initializing buffer pool, size = 128.0M
   101223 15:39:18  InnoDB: Completed initialization of buffer pool
   101223 15:39:18  InnoDB: highest supported file format is Barracuda.
   101223 15:39:18  InnoDB: 1.1.4 started; log sequence number 1588771
   101223 15:39:18 [ERROR] //mysql/mysql/bin/mysqld: unknown option '--skip-locking'
   101223 15:39:18 [ERROR] Aborting
   原因同上,处理也同上

3)  启动mysql服务时出现:
   Starting MySQL.The server quit without updating PID file (/w/mysqld558/xcw.pid).[FAILED]
   原因是由于data没有设置好,解决:vi mysql : datadir=/w/mysqld558 fix to datadir=/mysql/mysql/data

大功告成!