源码包编译安装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 16:18
下一篇 2017-03-16 16:27

相关推荐

  • 进程和计划任务

    进程概念 内核的功用:进程管理,文件系统,网络功能,内存管理,驱动程序,安全功能等 Process:运行中的程序的一个副本,是被载入内存的一个指令集和     进程ID(Process ID,PID)号码被用来标记各个进程     UID,GID和SELinux语境决定对文件系统…

    Linux干货 2016-09-13
  • 第四周 N28 (用户及权限管理及BRE、ERE应用)

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 # cp -r /etc/skel /home/tuser1 # chmod -R og= /home/tuser1 2、编辑/etc/group文件,添加组hadoop。 hadoop:x:1000: 3、手动编辑/etc…

    2017-12-22
  • 文件系统层次标准FHS

    FHS针对目录树架构仅定义出三层目录下应该放置哪些数据,分别是下面三个目录: /(根目录):与开机系统有关; /usr(unix software resource):与软件安装执行有关; /var(variable):与系统运作过程有关。   下面分别对上述三层目录进行详细的阐述。   (1) /(根目录)   根目录是整个系统最重要的一个目录,…

    Linux干货 2016-10-19
  • CentOS环境下,ab性能测试功具介绍及使用

    网站性能压力测试是服务器网站性能调优过程中必不可缺少的一环。只有让服务器处在高压情况下,才能真正体现出软件、硬件等各种设置不当所暴露出的问题。 性能测试工具目前最常见的有以下几种:ab、http_load、webbench、siege。 ab是apache自带的压力测试工具。ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型…

    Linux干货 2017-07-22
  • 第十四周作业

    系统的INPUT和OUTPUT默认策略为DROP; 1、限制本地主机的web服务器在周一不允许访问;新请求的速率不能超过100个每秒;web服务器包含了admin字符串的页面不允许访问;web服务器仅允许响应报文离开本机; ]# iptables -P INPUT DROP #INPUT默认策略为DROP ]# iptables -P OUTPUT DROP…

    Linux干货 2017-04-12
  • linux下zip包的压缩与解压

    linux zip 命令详解  功能说明:压缩文件。  语 法:zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$][-b <工作目录>][-ll][-n <字尾字符串>][-t <日期时间>][-<压缩效率>][压缩文件][文件…][-i <范本样式&gt…

    Linux干货 2017-04-10

评论列表(1条)

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

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