MySQL

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

#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的安装目录及数据库存放目录

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

  

3:创建mysql用户及用户组

#groupadd mysql
#useradd -r -g mysql mysql

  

4:安装mysql

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

[root@10-4-5-9 gechong]# ls
mysql

[root@10-4-5-9 gechong]# pwd
/gechong


[root@10-4-5-9 gechong]# tar -zxv -f /root/mysql-5.6.21.tar.gz

[root@10-4-5-9 gechong]# cd mysql-5.6.21/

编译:

 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 

 

报错了:

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!

 

#yum -y install ncurses-devel

 

#rm -f CMakeCache.txt

  

重新编译:

# make clean

# rm -f CMakeCache.txt

# rm -rf /etc/my.cnf

 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 

 

#make && make install

 很慢。。。等着吧

 

5:配置MySQL

# cd /gechong/mysql
# chown -R root:mysql .
# chown -R mysql:mysql data

  

6:

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

  

7:初始化权限表

#scripts/mysql_install_db --user=mysql

  

8:启动MySQL服务

#ln -s /gechong/mysql/bin/mysql /usr/bin

#service mysqld start 

 

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

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。