首页 / 数据库 / MySQL / 二进制安装MariaDB5.5.36
二进制安装MariaDB5.5.361.获取源码包解压,确定rpm包的mysql-server和mysql未安装[root@http1 mysql]# rpm -qa mysql[root@http1 mysql]# rpm -qa mysql-server[root@http1 ~]# lsanaconda-ks.cfg apr-util-1.5.3.tar.bz2 install.logapr-1.5.0 httpd24 install.log.syslogapr-1.5.0.tar.bz2 httpd-2.4.9 mariadb-5.5.36-linux-x86_64.tar.gzapr-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 ~]# lsanaconda-ks.cfg apr-util-1.5.3.tar.bz2 install.logapr-1.5.0 httpd24 install.log.syslogapr-1.5.0.tar.bz2 httpd-2.4.9 mariadb-5.5.36-linux-x86_64apr-util-1.5.3 httpd-2.4.9.tar.bz2 mariadb-5.5.36-linux-x86_64.tar.gz2.移动到程序安装目录并创建软链接[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/ mysql3.创建mysql属主属组[root@http1 local]# /usr/sbin/groupadd -r mysql[root@http1 local]# /usr/sbin/useradd -r -g mysql mysql4.创建数据存放目录格式化磁盘,设置为LVM[root@http1 mysql]#echo "p
n
p
3
+30G
t
3
8e
w" |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" created5.文件系统xfs的支持[root@http1 mysql]# yum install xfsprogs[root@http1 mysql]# mkfs -t xfs /dev/myvg/mylv6.实现自动挂载[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 -a7.创建数据在逻辑卷上的存放目录创建,更改目录属主属组[root@http1 mysql]# mkdir /mydata/data[root@http1 mysql]# chown -R mysql:mysql /mydata/data8.初始化安装mariadb[root@http1 mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data[root@http1 mysql]# ls /mydata/dataaria_log.00000001 aria_log_control mysql performance_schema test9.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-lockingkey_buffer_size = 256Mmax_allowed_packet = 1Mtable_open_cache = 256sort_buffer_size = 1Mread_buffer_size = 1Mread_rnd_buffer_size = 4Mmyisam_sort_buffer_size = 64Mthread_cache_size = 8query_cache_size= 16Minnodb_file_per_table = on #每个innodb文件一个表空间# Try number of CPU"s*2 for thread_concurrencythread_concurrency = 8 #线程数量,是cpu核心数*210.mariadb服务脚本创建因为mariadb和mysql是兼容的,直接命名成mysql好记忆[root@http1 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld[root@http1 mysql]# chkconfig --list mysqldservice mysqld supports chkconfig, but is not referenced in any runlevel (run "chkconfig --add mysqld")[root@http1 mysql]# chkconfig --add mysqld11.启动mysqld服务[root@http1 mysql]# service mysqld startStarting MySQL... [ OK ][root@http1 ~]# ls /mydata/data/ aria_log.00000001 ibdata1 mysql performance_schemaaria_log_control ib_logfile0 mysql-bin.000001 testhttp1.stu31.com.pid ib_logfile1 mysql-bin.index12.测试启动加入mysql路径进环境变量[root@http1 mysql]# vim /etc/profile.d/mysqld.shexport PATH=/usr/local/mysql/bin:$PATH[root@http1 mysql]# source /etc/profile.d/mysqld.sh[root@http1 mysql]# mysqlWelcome to the MariaDB monitor. Commands end with ; or g.Your MariaDB connection id is 2Server version: 5.5.36-MariaDB-log MariaDB ServerCopyright (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.htmMariaDB Proxy读写分离的实现 http://www.linuxidc.com/Linux/2014-05/101306.htmLinux下编译安装配置MariaDB数据库的方法 http://www.linuxidc.com/Linux/2014-11/109049.htmCentOS系统使用yum安装MariaDB数据库 http://www.linuxidc.com/Linux/2014-11/109048.htm安装MariaDB与MySQL并存 http://www.linuxidc.com/Linux/2014-11/109047.htmUbuntu 上如何将 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/110048htmMariaDB 的详细介绍:请点这里
MariaDB 的下载地址:请点这里本文永久更新链接地址