Linux下安装mysql-5.5

阅读更多

mysql 升级后需要cmake才能安装

 

# wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mysql.cs.pu.edu.tw/

# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz


# tar zxvf cmake-2.8.5.tar.gz 

# cd cmake-2.8.5

# ./bootstrap

# make

# make install   //这次没有报错

 

记得在另外一台机器上安装的时候报错

 

CMake Error at Utilities/cmake_install.cmake:36 (FILE):
  file INSTALL destination: /usr/local/man/man1 is not a directory.
Call Stack (most recent call first):
  cmake_install.cmake:57 (INCLUDE)

 

 需要执行这段代码指定安装路径

 

# make install DESTDIR="/some/absolute/path"

 

下面继续安装mysql

 

//新建一个工作组
# groupadd mysql
//新建用户
# adduser -g mysql mysql


# tar zxvf mysql-5.5.15.tar.gz 

# cd mysql-5.5.15


# CFLAGS="-O3" CXX=gcc 
# CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" 
# cmake . -LH|more //CMake下查看MySQL的编译配置  
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all 

-- MySQL 5.5.15
-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH) 
CMake Error at cmake/readline.cmake:83 (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:127 (FIND_CURSES)
  cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt:257 (MYSQL_CHECK_READLINE)

# yum -y install ncurses-devel
# rm CMakeCache.txt  //删除这个文件
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all

//现在OK了

# make  
# make install  



# chown -R mysql:mysql /usr/local/mysql  
# cp support-files/my-medium.cnf /etc/my.cnf  
# cd /usr/local/mysql/  
//初始化mysql数据库
# ./scripts/mysql_install_db --user=mysql 
//开启mysql
# /usr/local/mysql/bin/mysqld_safe --user=mysql &  //到这里发现一动不动了  我就ctrl C

# ps -aux | grep mysql //查看是否有mysql进程

/*
//有进程说明已经开启了
mysql     9682  0.3  2.0 352144 40256 pts/1    Sl   00:13   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid --socket=/tmp/mysql.sock --port=3306
*/

# /usr/local/mysql/bin/mysql 



Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.15-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

 

到这里mysql安装完成

 

 

 

參考文檔http://www.orczhou.com/index.php/2011/06/compile-and-install-mysql-5-5-from-source/

你可能感兴趣的:(mysql,Linux)