源码包编译安装MariaDB-10.1.22

源码包编译安装MariaDB-10.1.22

1、获取源码包

       mariadb-10.1.22.tar.gz

2、编译环境及依赖关系

    yum groupinstall -y Development Tools
    yum -y install gcc gcc-c++ make cmake ncurses ncurses-devel man ncurses libxml2 libxml2-devel openssl-devel bison bison-devel

3、创建mysql用户

    ~]# groupadd mysql
    ~]# useradd -s /sbin/nologin -g mysql -M mysql
    ~]# id mysql
    uid=500(mysql) gid=500(mysql) 组=500(mysql)
    ~]# ~]# mkdir /mydata/data -pv
    ~]# chown mysql:mysql /mydata/data/ -R

4、编译安装mariadb-10.1.22

解压源码包:

    ~]# tar xf mariadb-10.1.22.tar.gz

编译安装MariaDB:

    ~]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \            
    -DMYSQL_DATADIR=/mydata/data  \                                     
    -DWITH_INNOBASE_STORAGE_ENGINE=1 \                               
    -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
    -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
    -DWITH_READLINE=1 -DWITH_SSL=system \
    -DWITH_ZLIB=system -DWITH_LIBWRAP=0 \
    -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
    -DDEFAULT_CHARSET=utf8 \
    -DDEFAULT_COLLATION=utf8_general_ci

    参考:https://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html

    ~]# make -j 4
    ~]# make install

5、配置安装MariaDB

    ~]# cd /usr/local/mysql/
    ~]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data
    ~]# ls /mydata/data/
    aria_log.00000001  ib_logfile0        mysql             performance_schema  test-jian.pid
    aria_log_control   ib_logfile1        mysql-bin.000001  test
    ibdata1            multi-master.info  mysql-bin.index   test-jian.err

6、MariaDB配置文件创建及更改,有模版

    ~]# mkdir /etc/mysql
    ~]# cp support-files/my-large.cnf /etc/mysql/my.cnf
    ~]# vim /etc/mysql/my.cnf 
    [mysqld]
    port            = 3306
    datadir         = /mydata/data
    socket          = /tmp/mysql.sock
    skip-external-locking
    key_buffer_size = 256M
    max_allowed_packet = 1M
    table_open_cache = 256
    sort_buffer_size = 1M
    read_buffer_size = 1M
    read_rnd_buffer_size = 4M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size= 16M
    # Try number of CPU's*2 for thread_concurrency
    thread_concurrency = 8
    innodb_file_per_table = on
    skip_name_resolve = on

创建服务脚本:

    ~]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld 
    ~]# chkconfig --list mysqld
    ~]# chkconfig --add mysqld

启动mysqld服务,测试启动:

    ~]# service mysqld start

7、设置环境变量

    ~]# vim /etc/profile.d/mysqld.sh
    MYSQL_HOME=/usr/local/mysql
    export PATH=$MYSQL_HOME/bin:$PATH

加载环境变量:

    ~]# source /etc/profile.d/mysqld.sh

连接MySQL:

    ~]# mysql
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 17
    Server version: 10.1.22-MariaDB Source distribution

    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

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

    MariaDB [(none)]>

原创文章,作者:641348038@qq.com,如若转载,请注明出处:http://www.178linux.com/71200

(2)
641348038@qq.com641348038@qq.com
上一篇 2017-03-16
下一篇 2017-03-16

相关推荐

  • LAMP分离环境的搭建(最新版本的mysql+php+http源码编译安装)

    实验者:FrankStar      实验日期:20150628 任务:主要是实现在Linux环境下配置LAMP环境,利用VMware+centos6.4实现,将LAMP分离为多台主机; 附注:由于大家的环境不一样,可能有些人已经安装了这个包或者那个软件,所以调试的环境结果也不一样,为了尽量能模拟到 可能出现的所有问题,在编译会…

    Linux干货 2015-06-30
  • 私人定制—linux系统

    自制Linux系统: 1、分区并创建文件系统 [root@localhost6 ~]# fdisk  /dev/sdb 分两个必要的分区 /dev/sdb1对应/boot /dev/sdb2对应根/ 创建文件系统: [root@localhost6 ~]# mkfs.ext4 /dev/s…

    Linux干货 2016-09-26
  • grep虐我千百遍,我待grep如初恋

    N21第四周博客作业 1、  复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@Centos6 ~]# cp -r /etc/skel /home/tuser1 [root@Centos6 ~]#…

    Linux干货 2016-07-16
  • Python入门之迭代,列表解析,生成器及文件操作

    迭代器是访问集合元素的一种方式,迭代器包含了__iter__()(返回迭代器对象本身)next()(返回迭代器的下一个元素)迭代器只能往前不会退后 以下类型支持迭代 序列类型:list,str,tuple 非序列类型:dict,file 自定义类 通过内建的函数iter()或对象自带方法__iter__可以获取迭代器对象 l1=range(5) iter1=…

    Linux干货 2015-12-13
  • 运维自动化之系统安装

    自动化安装系统,cobbler的安装使用

    Linux干货 2018-01-15
  • Linux文件查看和管理类命令

    1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。
    4、文件的元数据信息有哪些,分别表示什么含义,如何查看?如何修改文件的时间戳信息。

    2018-03-17

评论列表(1条)

  • 马哥教育
    马哥教育 2017-03-29 17:36

    非常详细的使用介绍,加油。