centos下mysql最新版5.6.25源码编译安装-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 1637562
  • 博文数量: 63
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 646
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-26 18:02
个人简介

祸兮福之所倚,福兮祸之所伏

文章分类

全部博文(63)

文章存档

2020年(11)

2019年(10)

2017年(10)

2016年(25)

2015年(7)

我的朋友
相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: mysql/postgresql

2015-06-29 14:23:29

         毋庸置疑mysql是当今使用最多的数据库,也是当今最流行的数据库之一,当然未来mysql的发展方向估计也是根据oracle公司惯常用的手法进行中,前景并不乐观,不过作为最经典的数据库关系系统,学好它对于理解其他数据库系统是个很好的基础。现在我演示下至今为止凯发k8官网下载客户端中心官网发布的最新版5.6.25 的源码安装方式。
      安装系统:centos6.5 64位
      安装版本:mysql 5.6.25 
      安装环境: 安装cmake   gcc-c  bison   git make ncurses ncurses-devel libaio
      cmake的重要特性之一是其独立于源码(out-of-source)的编译功能,即编译工作可以在另一个指定的目录中而非源码目录中进行,这可以保证源码目录不受任何一次编译的影响,因此在同一个源码树上可以进行多次不同的编译,如针对于不同平台编译。
      cmake指定编译选项的方式不同于make,其实现方式对比如下:
       ./configure           cmake .
       ./configure --help    cmake . -lh or ccmake .
   

       指定安装文件的安装路径时常用的选项:
         -dcmake_install_prefix=/usr/local/mysql 
         -dmysql_datadir=/usr/local/mysql/data
         -dsysconfdir=/etc




默认编译的存储引擎包括:csv、myisam、myisammrg和heap。若要安装其它存储引擎,可以使用类似如下编译选项:
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1


若要明确指定不编译某存储引擎,可以使用类似如下的选项:
-dwithout__storage_engine=1
比如:
-dwithout_example_storage_engine=1
-dwithout_federated_storage_engine=1
-dwithout_partition_storage_engine=1


如若要编译进其它功能,如ssl等,则可使用类似如下选项来实现编译时使用某库或不使用某库:
-dwith_readline=1
-dwith_ssl=system
-dwith_zlib=system
-dwith_libwrap=0


其它常用的选项:
-dmysql_tcp_port=3306
-dmysql_unix_addr=/tmp/mysql.sock
-denabled_local_infile=1
-dextra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_debug=0
-denable_profiling=1






如果想清理此前的编译所生成的文件,则需要使用如下命令:
make clean
rm cmakecache.txt


     
     首先去下载mysql源码包,
         
        下载完解压   
        进入目录开始编译
    使用默认模式直接编译   cmake ./   
     
    如果要自定义安装,通过cmake . -lh or ccmake .  查看相关配置
   
然后再     

点击(此处)折叠或打开

  1. make && make install

编译完成(编译需要一段时间)

创建mysql用户和组

点击(此处)折叠或打开

  1. groupadd mysql
  2. useradd -r -g mysql mysql

修改用户组和用户名
chown -r mysql:mysql /usr/local/mysql 

增加环境变量 
vim /etc/profile  最后一行加入export path=$path:/usr/local/mysql/bin

开始安装数据库
  进入script      ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ 
 
   
   installing mysql system tables...2015-06-29 14:07:05 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-29 14:07:05 1628 [note] innodb: using atomics to ref count buffer pool pages
2015-06-29 14:07:05 1628 [note] innodb: the innodb memory heap is disabled
2015-06-29 14:07:05 1628 [note] innodb: mutexes and rw_locks use gcc atomic builtins
2015-06-29 14:07:05 1628 [note] innodb: memory barrier is not used
2015-06-29 14:07:05 1628 [note] innodb: compressed tables use zlib 1.2.3
2015-06-29 14:07:05 1628 [note] innodb: using cpu crc32 instructions
2015-06-29 14:07:05 1628 [note] innodb: initializing buffer pool, size = 128.0m
2015-06-29 14:07:05 1628 [note] innodb: completed initialization of buffer pool
2015-06-29 14:07:05 1628 [note] innodb: the first specified data file ./ibdata1 did not exist: a new database to be created!
2015-06-29 14:07:05 1628 [note] innodb: setting file ./ibdata1 size to 12 mb
2015-06-29 14:07:05 1628 [note] innodb: database physically writes the file full: wait...
2015-06-29 14:07:05 1628 [note] innodb: setting log file ./ib_logfile101 size to 48 mb
2015-06-29 14:07:06 1628 [note] innodb: setting log file ./ib_logfile1 size to 48 mb
2015-06-29 14:07:06 1628 [note] innodb: renaming log file ./ib_logfile101 to ./ib_logfile0
2015-06-29 14:07:06 1628 [warning] innodb: new log files created, lsn=45781
2015-06-29 14:07:06 1628 [note] innodb: doublewrite buffer not found: creating new
2015-06-29 14:07:06 1628 [note] innodb: doublewrite buffer created
2015-06-29 14:07:06 1628 [note] innodb: 128 rollback segment(s) are active.
2015-06-29 14:07:06 1628 [warning] innodb: creating foreign key constraint system tables.
2015-06-29 14:07:06 1628 [note] innodb: foreign key constraint system tables created
2015-06-29 14:07:06 1628 [note] innodb: creating tablespace and datafile system tables.
2015-06-29 14:07:06 1628 [note] innodb: tablespace and datafile system tables created.
2015-06-29 14:07:06 1628 [note] innodb: waiting for purge to start
2015-06-29 14:07:06 1628 [note] innodb: 5.6.21 started; log sequence number 0
2015-06-29 14:07:07 1628 [note] binlog end
2015-06-29 14:07:07 1628 [note] innodb: fts optimize thread exiting.
2015-06-29 14:07:07 1628 [note] innodb: starting shutdown...
2015-06-29 14:07:07 1628 [note] innodb: shutdown completed; log sequence number 1625977
ok


filling help tables...2015-06-29 14:07:07 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-29 14:07:07 1651 [note] innodb: using atomics to ref count buffer pool pages
2015-06-29 14:07:07 1651 [note] innodb: the innodb memory heap is disabled
2015-06-29 14:07:07 1651 [note] innodb: mutexes and rw_locks use gcc atomic builtins
2015-06-29 14:07:07 1651 [note] innodb: memory barrier is not used
2015-06-29 14:07:07 1651 [note] innodb: compressed tables use zlib 1.2.3
2015-06-29 14:07:07 1651 [note] innodb: using cpu crc32 instructions
2015-06-29 14:07:07 1651 [note] innodb: initializing buffer pool, size = 128.0m
2015-06-29 14:07:07 1651 [note] innodb: completed initialization of buffer pool
2015-06-29 14:07:07 1651 [note] innodb: highest supported file format is barracuda.
2015-06-29 14:07:08 1651 [note] innodb: 128 rollback segment(s) are active.
2015-06-29 14:07:08 1651 [note] innodb: waiting for purge to start
2015-06-29 14:07:08 1651 [note] innodb: 5.6.21 started; log sequence number 1625977
2015-06-29 14:07:08 1651 [note] binlog end
2015-06-29 14:07:08 1651 [note] innodb: fts optimize thread exiting.
2015-06-29 14:07:08 1651 [note] innodb: starting shutdown...
2015-06-29 14:07:09 1651 [note] innodb: shutdown completed; log sequence number 1625987
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 test3 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//bin/mysqld_safe &


you can test the mysql daemon with mysql-test-run.pl


  cd mysql-test ; perl mysql-test-run.pl


please report any problems at />

the latest information about mysql is available on the web at


  http://


support mysql by buying support/licenses at />

new default config file was created as /usr/local/mysql//my.cnf and
will be used by default by the server when you start it.
you may edit this file to change server settings


warning: default config file /etc/my.cnf exists on the system
this file will be read by default by the mysql server
if you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server


数据库初始化完毕!!!

复制数据库启动脚本  cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
复制配置文件            cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf   如果原来就有配置文件就覆盖

编辑配置文件my.cnf指定文件路径和端口  
  basedir = /usr/local/mysql
  datadir =/usr/local/mysql/data
  port = 3306
  
 启动服务
[root@test3 ~]# service mysqld start
starting mysql................ success! 
为root设置密码
    mysqladmin -u root password "root"
设置成功
    进入数据库
       mysql -uroot -proot

[root@test3 ~]# mysql -uroot -proot
warning: using a password on the command line interface can be insecure.
welcome to the mysql monitor.  commands end with ; or \g.
your mysql connection id is 3
server version: 5.6.21 source distribution


凯发app官方网站 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> 

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


mysql> 

至此安装成功。
 
阅读(1669) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图