手机版
你好,游客 登录 注册
背景:
阅读新闻

二进制安装MariaDB5.5.36

[日期:2014-12-23] 来源:Linux社区  作者: [字体:大 中 小]

二进制安装MariaDB5.5.36

1.获取源码包解压,确定rpm包的mysql-server和mysql未安装

[root@http1 mysql]# rpm -qa mysql

[root@http1 mysql]# rpm -qa mysql-server

[root@http1 ~]# ls

anaconda-ks.cfg    apr-util-1.5.3.tar.bz2  install.log

apr-1.5.0          httpd24                install.log.syslog

apr-1.5.0.tar.bz2  httpd-2.4.9            mariadb-5.5.36-linux-x86_64.tar.gz

apr-util-1.5.3    httpd-2.4.9.tar.bz2

[root@http1 ~]# tar xf mariadb-5.5.36-linux-x86_64.tar.gz

[root@http1 ~]# ls

anaconda-ks.cfg    apr-util-1.5.3.tar.bz2  install.log

apr-1.5.0          httpd24                install.log.syslog

apr-1.5.0.tar.bz2  httpd-2.4.9            mariadb-5.5.36-linux-x86_64

apr-util-1.5.3    httpd-2.4.9.tar.bz2    mariadb-5.5.36-linux-x86_64.tar.gz

2.移动到程序安装目录并创建软链接

[root@http1 ~]# mv mariadb-5.5.36-linux-x86_64 /usr/local

[root@http1 ~]# cd /usr/local/

[root@http1 local]# ln -s mariadb-5.5.36-linux-x86_64/ mysql

3.创建mysql属主属组

[root@http1 local]# /usr/sbin/groupadd -r mysql

[root@http1 local]# /usr/sbin/useradd -r -g mysql mysql

4.创建数据存放目录

格式化磁盘,设置为LVM

[root@http1 mysql]#echo "p\nn\np\n3\n\n+30G\nt\n3\n8e\nw" |fdisk /dev/sda

[root@http1 mysql]# partx -a  /dev/sda

创建LVM卷组及逻辑卷

[root@http1 mysql]# pvcreate /dev/sda3

  Physical volume "/dev/sda3" successfully created

[root@http1 mysql]# vgcreate myvg /dev/sda3

  Volume group "myvg" successfully created

[root@http1 mysql]# lvcreate -L 10G -n mylv myvg

  Logical volume "mylv" created

5.文件系统xfs的支持

[root@http1 mysql]# yum install xfsprogs

[root@http1 mysql]# mkfs -t xfs /dev/myvg/mylv

6.实现自动挂载

[root@http1 mysql]# blkid /dev/myvg/mylv

/dev/myvg/mylv: UUID="b7aa948b-89d7-40d6-887b-9821a257c408" TYPE="xfs"

[root@http1 mysql]# vim /etc/fstab   

UUID="b7aa948b-89d7-40d6-887b-9821a257c408"    /mydata  xfs  defaults  0 0

[root@http1 mysql]# mkdir /mydata

[root@http1 mysql]# mount -a

7.创建数据在逻辑卷上的存放目录创建,更改目录属主属组

[root@http1 mysql]# mkdir /mydata/data

[root@http1 mysql]# chown -R mysql:mysql /mydata/data

8.初始化安装mariadb

[root@http1 mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data

[root@http1 mysql]# ls /mydata/data

aria_log.00000001  aria_log_control  mysql  performance_schema  test

9.mariadb配置文件创建,有模版

[root@http1 mysql]# mkdir /etc/mysql

[root@http1 mysql]# cp support-files/my-large.cnf /etc/mysql/my.cnf

修改配置文件:

[root@http1 mysql]# vim /etc/mysql/my.cnf

# The MariaDB server

[mysqld]

data_dir = /mydata/data                        #数据库数据存放目录

port            = 3306                        #监听端口

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

innodb_file_per_table = on                    #每个innodb文件一个表空间

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8                        #线程数量,是cpu核心数*2

10.mariadb服务脚本创建

因为mariadb和mysql是兼容的,直接命名成mysql好记忆

[root@http1 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

[root@http1 mysql]# chkconfig --list mysqld

service mysqld supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add mysqld')

[root@http1 mysql]# chkconfig --add mysqld

11.启动mysqld服务

[root@http1 mysql]# service mysqld start

Starting MySQL...                                          [  OK  ]

[root@http1 ~]# ls /mydata/data/     

aria_log.00000001    ibdata1      mysql            performance_schema

aria_log_control    ib_logfile0  mysql-bin.000001  test

http1.stu31.com.pid  ib_logfile1  mysql-bin.index

12.测试启动

加入mysql路径进环境变量

[root@http1 mysql]# vim /etc/profile.d/mysqld.sh

export PATH=/usr/local/mysql/bin:$PATH

[root@http1 mysql]# source /etc/profile.d/mysqld.sh

[root@http1 mysql]# mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 2

Server version: 5.5.36-MariaDB-log MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> select version();

+--------------------+

| version()          |

+--------------------+

| 5.5.36-MariaDB-log |

+--------------------+

1 row in set (0.00 sec)

安装完成!

在 CentOS/RHEL/Scientific Linux 6 下安装 LAMP (Apache with MariaDB and PHP) http://www.linuxidc.com/Linux/2013-07/86755.htm

MariaDB Proxy读写分离的实现 http://www.linuxidc.com/Linux/2014-05/101306.htm

Linux下编译安装配置MariaDB数据库的方法 http://www.linuxidc.com/Linux/2014-11/109049.htm

CentOS系统使用yum安装MariaDB数据库 http://www.linuxidc.com/Linux/2014-11/109048.htm

安装MariaDB与MySQL并存 http://www.linuxidc.com/Linux/2014-11/109047.htm

Ubuntu 上如何将 MySQL 5.5 数据库迁移到 MariaDB 10  http://www.linuxidc.com/Linux/2014-11/109471.htm

[翻译]Ubuntu 14.04 (Trusty) Server 安装 MariaDB  http://www.linuxidc.com/Linux/2014-12/110048htm

MariaDB 的详细介绍:请点这里
MariaDB 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-12/110794.htm

linux
相关资讯       MariaDB安装 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款