mysql5.5开始,源码配置编译工具configure变成了cmake,所以先要去把cmake装上。并安装make,bison,cmake,gcc-c++,ncurses的包

去http://www.cmake.org/cmake/resources/software.html 下载cmake

./cmake-2.8.12.2-Linux-i386.sh  --prefix=/usr/local/

ln -s /usr/local/cmake-2.8.12.2-Linux-i386/bin/cmake /usr/bin/cmake

先执行# cmake . -LH 检查一下cmake查看支持的参数,也可以去http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html 查看编译时可指定参数的详细描述,还可以参考安装文档里面的这一章节:2.9.4 MySQL Source-Configuration Options。

常用参数如下:

CMAKE_INSTALL_PREFIX:指定MySQL程序的安装目录,默认/usr/local/mysql
DEFAULT_CHARSET:指定服务器默认字符集,默认latin1
DEFAULT_COLLATION:指定服务器默认的校对规则,默认latin1_general_ci
ENABLED_LOCAL_INFILE:指定是否允许本地执行LOAD DATA INFILE,默认OFF
WITH_COMMENT:指定编译备注信息
WITH_xxx_STORAGE_ENGINE:指定静态编译到mysql的存储引擎,MyISAM,MERGE,MEMBER以及CSV四种引擎默认即被编译至服务器,不需要特别指定。
WITHOUT_xxx_STORAGE_ENGINE:指定不编译的存储引擎
SYSCONFDIR:初始化参数文件目录
MYSQL_DATADIR:数据文件目录
MYSQL_TCP_PORT:服务端口号,默认3306
MYSQL_UNIX_ADDR:socket文件路径,默认/tmp/mysql.sock

实际执行时指定的参数如下:

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DMYSQL_USER=mysql
[root@nosql1 mysql-]# cmake . -DCMAKE_INSTALL_PREFIX=/u01/mysql -DMYSQL_DATADIR=/u01/mysql/mysql/data -DSYSCONFDIR=/etc\
> -DDEFAULT_CHARSET=gbk\
> -DDEFAULT_COLLATION=gbk_general_ci\
> -DMYSQL_USER=mysql
-- Running cmake version
-- MySQL
-- Packaging as: mysql--Linux-x86_64
-- Could NOT find Curses  (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake: (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: (FIND_CURSES)
  cmake/readline.cmake: (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt: (MYSQL_CHECK_READLINE)

-- Configuring incomplete, errors occurred!

cmake过程中,报了一个这个错,根据提示安装ncurses-devel,并find / -name CMakeCache.txt,把列出来的删除点,重新cmake就行了。

然后接着make

然后再执行make install

编译完成后,安装数据库

[root@ora11g mysql]# ls
bin  COPYING  data  docs  include  INSTALL-BINARY  lib  man  mysql-test  README  scripts  share  sql-bench  support-files
[root@ora11g mysql]# cd scripts/
[root@ora11g scripts]# ls
mysql_install_db
[root@ora11g scripts]# ./mysql_install_db --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h ora11g password 'new-password'

Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

[root@ora11g scripts]# 

这一步也可以先修改support-files里面的模板,在模板里面添加上 --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

如果不加basedir和datadir的话,初始化会报错:

[root@nosql1 scripts]# ./mysql_install_db  --defaults-file=../my.cnf --user=mysql                 

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option

在bin下执行,mysql_install_db --default-file=my.cnf --user=mysql

mysql的启动:

[mysql@ora11g ~]$ cd /usr/local/mysql/bin/
[mysql@ora11g bin]$ ./mysqld
mysqld         mysqld_multi   mysqld_safe    mysqldump      mysqldumpslow
[mysql@ora11g bin]$ ./mysqld_safe --user=mysql &
[1] 2244
[mysql@ora11g bin]$ 140327 21:17:41 mysqld_safe Logging to '/usr/local/mysql/data/ora11g.err'.
140327 21:17:41 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

[mysql@ora11g bin]$
[mysql@ora11g bin]$ ps -ef | grep mysql
root      2082  1786  0 21:17 pts/2    00:00:00 su - mysql
mysql     2083  2082  0 21:17 pts/2    00:00:00 -bash
mysql     2244  2083  0 21:17 pts/2    00:00:00 /bin/sh ./mysqld_safe --user=mysql
mysql     2496  2244  1 21:17 pts/2    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/ora11g.err --pid-file=/usr/local/mysql/data/ora11g.pid --socket=/tmp/mysql.sock --port=3306
mysql     2579  2083  0 21:17 pts/2    00:00:00 ps -ef
mysql     2580  2083  0 21:17 pts/2    00:00:00 grep mysql
[mysql@ora11g bin]$ 

mysql的登录:

[mysql@ora11g bin]$ ./mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37 Source distribution

Copyright (c) 2000, 2014, 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> select version();
+-----------+
| version() |
+-----------+
| 5.5.37    |
+-----------+
1 row in set (0.00 sec)

mysql> 

源码方式安装mysql5.5的更多相关文章

  1. RedHat 6.4源码方式安装mysql5.5

    参考文档:http://dev.mysql.com/downloads/file/?id=463397 下载地址http://dev.mysql.com/doc/refman/5.7/en/ 文档地址 ...

  2. 源码编译安装mysql5.5.33

    源码编译安装mysql5.5.33 一.安装cmake编译工具 跨平台编译器 # yum install -y gcc* # yum install -y cmake 解决依赖关系 # yum ins ...

  3. centos6.5环境源码编译安装mysql5.6.34

    centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...

  4. centos7下源码方式安装gitlab8.9+发送邮件+ldap

    CentOS7下源码方式安装gitlab 环境描述 操作系统: centos7 redis: >=2.8 mysql >=5.5.14 git >=2.7.4 架构设计 一台gitl ...

  5. 源码方式安装 lrzsz 库

    我们都知道安装了lrzsz工具的linux系统环境: 在shell里可以非常方便的上传和下载linux里面的文件: 通常的安装方式: yum install lrzsz sudo apt-get in ...

  6. 源码方式安装 lrzsz库

    源码方式安装 lrzsz库:https://www.cnblogs.com/cocoajin/p/11731787.html 我们都知道安装了lrzsz工具的linux系统环境,在shell里可以非常 ...

  7. Linux上生产环境源码方式安装配置postgresql12

    1.Linux上源码方式安装postgresql12 01.准备操作系统环境 echo "192.168.1.61 tsepg61" >> /etc/hosts mou ...

  8. 2-14 MySQL初步认识,及CentOS6.8环境,源码方式安装MySQL

    什么是数据库: 存放数据的仓库RDBMS-->(Relational Database Management System) 关系型数据库管理系统DBMS--->(Database Man ...

  9. Centos6 系统下源码方式安装Mysql 记录

    在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配. #### ...

随机推荐

  1. iOS 中 为UIView添加背景图片

    创建UIImage的方法有两种: UIImage *image = [UIImageimageNamed:@"image.jpg"];//这种不释放内存,要缓存 NSString ...

  2. window下安装mongodb及php mongo扩展

    1.安装mongoDB 下载最新版本的 MongoDB 下载地址:http://www.mongodb.org/downloads 解压文件到 D:\mongodb 解压后的文件列表如下: 创建数据存 ...

  3. aspx、ashx、asmx文件处理请求效率比较

    人生总是面临着许多抉择许多困惑!作为一名“攻城师”或“程序猿”的我们,工作的时候更是如此.你曾经是否苦恼过在系统中使用哪种文件编写客户端请求最合适或最高效呢?aspx.ashx.asmx到底该如何选择 ...

  4. spring3 的restful API RequestMapping介绍

    原文链接:http://www.javaarch.net/jiagoushi/694.htm spring3 的restful API RequestMapping介绍 在spring mvc中 @R ...

  5. Unity Assets目录下的特殊文件夹名称

    1.隐藏文件夹以.开头的文件夹会被Unity忽略.在这种文件夹中的资源不会被导入,脚本不会被编译.也不会出现在Project视图中.2.Standard Assets在这个文件夹中的脚本最先被编译.这 ...

  6. ios 修正waring:Method override for the designated initializer of the superclass '-init' not found

    swift引入后,为了使oc和swift更相近,对oc的初始化方法也进行了修正,具体说明,见下面的链接,这个waring的最简单的修正方法是,到相应类的头文件中,去掉在自定义初始化方法后面的 NS_D ...

  7. ACM/ICPC 之 Floyd+记录路径后继(Hdu1385(ZOJ1456))

    需要处理好字典序最小的路径 HDU1385(ZOJ1456)-Minimum Transport //Hdu1385-ZOJ1456 //给定邻接矩阵,求给定起点到终点的最短路径,若有相同路长的路径按 ...

  8. UVALive 4949 Risk(二分网络流、SAP)

    n个区域,每个区域有我方军队a[i],a[i]==0的区域表示敌方区域,输入邻接矩阵.问经过一次调兵,使得我方边界处(与敌军区域邻接的区域)士兵的最小值最大.输出该最大值.调兵从i->j仅当a[ ...

  9. Log4j的使用

    一,Log4j简介 日志的三个目的: 1. 监视代码中变量的变化情况,周期性的记录到文件中供其他应用进行统计分析工作                      2.跟踪代码运行时轨迹,作为日后审计的依 ...

  10. Jquery获取select 控件的change事件时选中的值

    HTML代码如下: <div class="col-sm-9 col-xs-12"> <select id="groupid" class=& ...