CentOS 6.5 源码安装MySQL5.6

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 6.5 源码安装MySQL5.6相关的知识,希望对你有一定的参考价值。

1:下载安装cmake (mysql5.5以后是通过cmake来编译的)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#http://download.csdn.net/detail/csxuedn/7976005
 
#wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
 
# tar -zxv -f /root/cmake-2.8.4.tar.gz
# cd cmake-2.8.4
#./configure
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
 
  
 
   #yum install gcc-c++
 
#./configure
# make && make install

  

2:创建mysql的安装目录及数据库存放目录

1
2
#mkdir -p /gechong/mysql                 //安装mysql
#mkdir -p /gechong/mysql/data            //存放数据库

  

3:创建mysql用户及用户组

1
#groupadd mysql
1
#useradd -g mysql -s /bin/false -M mysql

  

4:安装mysql

1
#wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.21.tar.gz

[[email protected] gechong]# ls
mysql

[[email protected] gechong]# pwd
/gechong

1
 

[[email protected] gechong]# tar -zxv -f /root/mysql-5.6.21.tar.gz

[[email protected] gechong]# cd mysql-5.6.21/

编译:

1
2
3
4
5
6
7
cmake . \
-DCMAKE_INSTALL_PREFIX=/gechong/mysql \
-DMYSQL_DATADIR=/gechong/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1

 

报错了:

1
2
3
4
5
6
7
8
9
10
11
CMake Error at cmake/readline.cmake:85 (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:128 (FIND_CURSES)
  cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
  CMakeLists.txt:427 (MYSQL_CHECK_EDITLINE)
 
 
-- Configuring incomplete, errors occurred!

 

1
#yum -y install ncurses-devel

 

1
#rm -f CMakeCache.txt

  

重新编译:

# make clean

# rm -f CMakeCache.txt

# rm -rf /etc/my.cnf

1
2
3
4
5
6
7
cmake . \
-DCMAKE_INSTALL_PREFIX=/gechong/mysql \
-DMYSQL_DATADIR=/gechong/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1

 

1
#make && make install

 很慢。。。等着吧

 

5:配置MySQL

1
# cd /gechong/mysql<br># chown -R root:mysql .<br># chown -R mysql:mysql data

  

6:

1
# cp support-files/my-default.cnf /etc/my.cnf

  

7:初始化权限表

1
#scripts/mysql_install_db --user=mysql

  

8:启动MySQL服务

1
2
3
#ln -s /gechong/mysql/bin/mysql /usr/bin
 
#service mysqld start 

 

10:之后空用户登陆MySQL,删除空用户,对用户赋权限。

http://blog.csdn.net/langeldep/article/details/6223649


以上是关于CentOS 6.5 源码安装MySQL5.6的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 6.5 二进制安装MySQL 5.6

CentOS-6.5安装zabbix 3.0.4

CentOS 6.5系统安装编译安装MySQL 5.6详细过程

CentOS 6.5通过yum安装 MySQL-5.5

centos6.5 安装mysql5.6多实例(多配置文件)

centos7.4 mysql5.6 源码安装