安装配置mariadb-10.1.19

本文参考:http://chenzehe.iteye.com/blog/1266260  感谢原作者的分享!

首先安装/更新一些编译时会用到的基础包

[[email protected] local]# yum -y install gcc gcc-c++ make cmake ncurses ncurses-devel libxml2 libxml2-devel openssl-devel bison bison-devel

mariadb下载: ftp://mirrors.fe.up.pt/pub/mariadb/mariadb-10.1.20/source/mariadb-10.1.20.tar.gz

编译安装MariaDB10.1.x的版本需要gcc支持c++11,不懂的朋友可以看我另外一篇文章:源码安装GCC-4.9.2

1、创建mysql用户

[[email protected] local]# groupadd mysql 
[[email protected] local]# useradd -s /sbin/nologin -g mysql -M mysql #不允许mysql用户登录

2、创建数据存放目录

[[email protected] local]# mkdir -pv /data/dbdata

[[email protected] local]# mkdir -pv /data/innodb
[[email protected] local]# chown -R mysql.mysql /data/ #修改目录权限为mysql

3、安装mariadb

[[email protected] mariadb-10.1.19]#
cmake -DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DSYSCONFDIR=/usr/local/mysql-DMYSQL_TCP_PORT=3306-DEXTRA_CHARSETS=all-DMYSQL_USER=mysql-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/dbdata-DWITH_XTRADB_STORAGE_ENGINE=1-DWITH_FEDERATEDX_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STPRAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWIYH_READLINE=1-DWIYH_SSL=system-DVITH_ZLIB=system-DWITH_LOBWRAP=0-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci
[[email protected] mariadb-10.1.19]# make
[[email protected] mariadb-10.1.19]# make install

到这里MariaDB已经算是安装上了,进行配置就可以使用了。本人在这里用的是多实例配置方法

1、初始化数据目录

  #把用到的工具添加到/usr/bin目录

[[email protected] mysql]# ln -s /usr/local/mysql/bin/mysqld_multi /usr/bin/mysqld_multi[[email protected] mysql]# ln -s /usr/local/mysql/scripts/mysql_install_db /usr/bin/mysql_install_db
[[email protected] mysql]#./scripts/mysql_install_db --datadir=/data/dbdata --user=mysql

2、配置多实例数据库配置文件

  a)修改my.cnf文件

[mysqld_multi]
 mysqld     = /usr/local/mysql/bin/mysqld_safe
 mysqladmin = /usr/local/mysql/bin/mysqladmin
 user       = mysql

 # The MySQL server
 [mysqld6033]
 port        = 6033
 #bind-address    = 127.0.0.1
 socket        = /tmp/mysql.sock.6033

 datadir     = /data/dbdata
 pid-file    = /data/dbdata/my.pid
 skip-external-locking
 skip-name-resolve
 interactive_timeout=86400
 wait_timeout=86400

 key_buffer = 384M
 max_allowed_packet = 4M
 table_cache = 8192
 sort_buffer_size = 2M
 read_buffer_size = 2M
 myisam_sort_buffer_size = 64M
 thread_cache = 32
 query_cache_size = 64M
 thread_concurrency = 32
 max_connection = 150
 max_connect_errors=400
 max_heap_table_size = 64M
 open_files_limit=2048
 slow_query_log = 1
 long_query_time = 2
 slow-query-log-file = /data/dbdata/slowquery.sql
 log-bin        = /data/dbdata/replication
 server-id    = 100
 #master-host            =    192.168.0.100
 #master-user            =    repuser
 #master-password        =    repuser123
 #master-port            =    6033
 #master-connect-retry   =    30
 log-slave-updates
 skip-slave-start
 character-set-server = utf8
 collation_server = utf8_general_ci
 master-info-file = /data/dbdata/master.info

 # Uncomment the following if you are using InnoDB tables
 innodb_data_home_dir = /data/innodb
 innodb_data_file_path = ibdata1:200M;ibdata2:200M;ibdata3:200M;ibdata4:200M;ibdata5:200M
 innodb_log_group_home_dir = /data/innodb/
 innodb_log_arch_dir = /data/innodb/
 innodb_buffer_pool_size = 700M
 innodb_additional_mem_pool_size = 256M
 innodb_log_file_size = 256M
 innodb_log_buffer_size = 32M
 innodb_flush_log_at_trx_commit = 0
 innodb_lock_wait_timeout = 50

 default_storage_engine = innodb

3、启动多实例数据库

#将/usr/local/mysql/bin加到$PATH环境变量里  [[email protected] mysql]# vi /etc/profile

export PATH=/usr/local/mysql/bin:$PATH  #插入到最后一行

#启动mysql
[[email protected] mysql]# mysqld_multi start 6033 –user  #6033是my.cnf里设置的端口

在启动的时候会加载innodb,中途不能重启,否则会出现如下错误

151114 00:59:38  mysqld started

151114  0:59:38 [Warning] option ‘thread_stack‘: unsigned value 126976 adjusted to 131072

InnoDB: No valid checkpoint found.

InnoDB: If this error appears when you are creating an InnoDB database,

InnoDB: the problem may be that during an earlier attempt you managed

InnoDB: to create the InnoDB data files, but log file creation failed.

InnoDB: If that is the case, please refer to

InnoDB: http://dev.mysql.com/doc/refman/5.0/en/error-creating-innodb.html

151114  0:59:38 [ERROR] Default storage engine (InnoDB) is not available

151114  0:59:38 [ERROR] Aborting

151114  0:59:38 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

151114 00:59:38  mysqld ended

删除innodb文件夹,重新启动就可以了

时间: 2024-10-12 00:41:38

安装配置mariadb-10.1.19的相关文章

Linux安装配置MariaDB数据库全程详解

MariaDB在很多方面强于MySQL,在Linux下如何安装MariaDB数据库成为大家比较头疼的一个问题,下面用实例为大家讲解下 MariaDB是采用Maria存储引擎的MySQL分支版本,在很多方面强于MySQL,那么在Linux下如何安装MariaDB数据库呢?下面小编就给大家介绍下Linux安装配置MariaDB数据库的方法. 说明: 操作系统:CentOS 5.10 32位 MariaDB版本:mariadb-5.5.33a MariaDB数据库存放目录:/data/mysql 准备

CentOS系统使用yum安装配置MariaDB数据库

http://www.server110.com/mariadb/201310/2670.html 1.在 /etc/yum.repos.d/ 下建立 MariaDB.repo,内容如下:[[email protected] etc]$ cd /etc/yum.repos.d[[email protected] yum.repos.d]$ vi MariaDB.repo# MariaDB 10.0 CentOS repository list - created 2013-08-23 13:08

CentOS 6.4安装配置MairaDB 10.3 Galera Cluster

一. 安装环境 不同版本的操作系统(CentOS 6 与 7).不同版本的数据库(MariaDB 10.1前后)相关安装配置命令不太一样. 1. 操作系统:CentOS 6.4 2. 数据库    :  MariaDB 10.3.7 二. 服务器规划 MariaDB01  192.168.10.178 MariaDB02  192.168.10.179 MariaDB03  192.168.10.180 三. 修改MariaDB01/02/03 hosts vi /etc/hosts 192.1

Windows10 下安装配置IIS + MySQL5.7.19 + nginx1.12.1 + php7.1.7

环境: VMWare Workstation Player12 Windows10 Pro x64 一.安装系统 vmware 会采用 fast install 方式很快装完,无需配置什么. 二.配置 IIS 在“程序和功能”下,打开“启用或关闭Windows功能”.把 Internet Infomation Services 功能添加进去,需要注意的是“应用程序开发功能”里边的CGI默认是不勾选的,需要手动选择 注:在实际安装时,IIS 我是最后添加的,但写在了最前面,没有什么特殊含义.但因此

CentOS7下安装配置MariaDB

参考: http://www.2cto.com/os/201504/394141.html http://outofmemory.cn/code-snippet/2533/mysql-create-database-specify-utf-8-coding https://mariadb.com/kb/en/mariadb/setting-character-sets-and-collations/ yum install mariadb mariadb-server systemctl sta

CentOS 6.4 安装 MariaDB 10.3

本文介绍如何使用yum在CentOS 6.4 安装 MariaDB 10.3 1. 创建mysql组 groupadd mysql 2. 创建mysql用户并添加到mysql组 useradd -g mysql mysql 3.修改mysql密码 passwd mysql 4. 配置 MariaDB 10.3 yum vi /etc/yum.repos.d/MariaDB.repo # MariaDB 10.3 CentOS repository list - created 2018-06-0

在centOS7.2安装配置zabbix监控

zabbix由两部分组成,zabbix-server与可选的zabbix-agent.zabbix-server可以通过SNMP,ZABBIX-AGENT,PING,端口监视等方法提供对远程服务器/网络状态的监控与数据收集. 安装环境: 192.168.1.12 server端,监控自己同时也监控其他主机(暂且叫client) 192.168.1.9 client端 准备:NTP时钟服务正常.DNS解析正常(在此两台服务器所以配置hosts即可) server端安装配置: 1) 挂载本地镜像,配

es2.4+kibanna安装配置

环境:这里集群机器为2 分别为10.100.19.205和206 配置hosts 10.100.19.206 master 10.100.19.210 slave1 这里在205机器上操作 1下载es2.4 2 解压到目录下 3 配置elasticsearch.yml,配置如下 cluster.name:fcar-cluster 集群名称 node.name:node-2 当前节点名称 host:10.100.19.205                                    

CentOS 7安装MariaDB 10详解以及相关配置

CentOS 7安装MariaDB 10详解以及相关配置 第一步:添加 MariaDB yum 仓库 首先在CentOS操作系统中/etc/yum.repos.d/目录下添加 MariaDB 的YUM配置文件MariaDB.repo文件. vi /etc/yum.repos.d/MariaDB.repo 在该文件中添加以下内容保存: [mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/10.2/centos7-amd64gpgkey=h

RHEL7使用国内yum源,安装Mariadb 10.2.25, 并配置字符集为utf8mb4

目前阿里, 清华,163等镜像站的Mariadb都是5.5的,有些项目需要用到更新的版本,所以顺便安装一下10版本的,并记录过程 添加中科大的Mariadb 10.2.25 yum源,并yum安装 [mariadb] name = MariaDB baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64 gpgkey = https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-