码迷,mamicode.com
首页 > 数据库 > 详细

Installing MariaDB Binary Tarballs

时间:2014-12-17 06:55:40      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:mariadb binary tarballs

开发环境:

[root@burgess~]# yum grouplist

Installed Groups:………………….查看安装此两个包组,若没有,则执行如下;

yumgroupinstall Development Tools

yumgroupinstall Server Platform Development

下载mariadb

网站下载:https://mariadb.org/

https://downloads.mariadb.org/mariadb/5.5.40/

http://mirrors.ustc.edu.cn/mariadb/mariadb-5.5.40/bintar-linux-x86_64/mariadb-5.5.40-linux-x86_64.tar.gz...................... stable General Available version

wgethttp://mirrors.ustc.edu.cn/mariadb/mariadb-5.5.40/bintar-linux-x86_64/mariadb-5.5.40-linux-x86_64.tar.gz

本地ftp下载

lftp ftp://172.16.0.1/pub/Sources/6.x86_64/mariadb

mget mariadb-5.5.36-linux-x86_64.tar.gz

 

解压MariaDB Binary Tarballs,

[root@burgess ~]# tar xfmariadb-5.5.36-linux-x86_64.tar.gz -C /usr/local  ……………………….展开至自定义目录/usr/local

 

创建软连接或更名(最好链接)

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

[root@burgess local]# ls

bin  etc games  include  lib lib64  libexec  mariadb-5.5.36-linux-x86_64 sbin  share  src

[root@burgess local]# lnmariadb-5.5.36-linux-x86_64 mysql -s

[root@burgess local]# ll  ………..查看软连接是否创建好;或者上一步直接用ln -sv 可直接查看

lrwxrwxrwx   1 root root  27 Dec 16 16:51 mysql-> mariadb-5.5.36-linux-x86_64

 

创建系统用户

[root@burgess local]# groupadd -r mysql

[root@burgess local]# useradd -g mysql -rmysql

[root@burgess local]# id  mysql ………………..查看用户及组ID信息

uid=496(mysql)gid=493(mysql) groups=493(mysql)

[root@burgess local]# cd mysql

[root@burgess mysql]# pwd   …………..查看当前路径

/usr/local/mysql

 

创建逻辑卷(可选);

[root@burgess local]# mkdir /mydata

[root@burgess local]# fdisk /dev/sda

p:查看主分区

n:新建分区

p 新建主分区

3 编号

+30G  添加分区大小

T ….为新加分区修改Td

3 指定分区编号

8e …………Td

P 查看Td是否生效

w:保存退出

[root@burgess mysql]# partx-a /dev/sda …………..让内核识别新分区

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

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

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

 

创建文件系统;…..xfs (若没有)

[root@burgess mysql]#yum list all | grepxfs

[root@burgess mysql]#yum -y installxfsprogs

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

[root@burgess mysql]#vim /etc/fstab  ………………..挂载至mydata(作用为逻辑卷增加大小的时候,不受影响)

/dev/myvg/mylv          /mydata     xfs defaults      0 0

[root@burgess mysql]#mount -a

[root@burgess mysql]#mount  ………………查看是否挂载上

 

创建/mydata/data :(因为mydata是在根下的,不在新分区上 ,所以挂载的文件会散装在新分区,不利于管理)

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

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

[root@burgess mysql]#ll /mydata

[root@burgess mysql]#pwd

[root@burgess mysql]#ll

 

Mariadb数据初始化;

[root@burgess mysql]#scripts/mysql_install_db--help   (重要选项释义)

  --datadir=path       The path to the MariaDB data directory. ……………………………………..数据目录存放位置

  --defaults-extra-file=name

                       Read this file after theglobal files are read.   …………………………………读取全局配置文件位置

   --skip-name-resolve  Use IP addresses rather than hostnames whencreating     ……………………….跳过主机名解析

                       grant tableentries.  This option can be useful if

                       your DNS does not work.

  --user=user_name     The login username to use for runningmysqld.  Files  ………………………………以哪个用户完成初始化

                       and directories createdby mysqld will be owned by this

                       user.  You must be root to use this option.  By default

                       mysqld runs using yourcurrent login name and files and

                       directories that itcreates will be owned by you.

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

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

aria_log.00000001  aria_log_control  mysql performance_schema  test

[root@burgess mysql]# ls

bin      COPYING.LESSER  docs    INSTALL-BINARY  man         README   share     support-files

COPYING  data            include  lib             mysql-test  scripts sql-bench

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

[root@burgess mysql]# cpsupport-files/my-large.cnf /etc/mysql/my.cnf

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

datadir=/mydata/data

innodb_file_per_table=on  ……………要修改的内容 =1也可以

[root@burgess mysql]#ls

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

[root@burgess mysql]# chkconfig --listmysqld

service mysqld supports chkconfig, but is not referenced in anyrunlevel (run ‘chkconfig --add mysqld‘)

[root@burgess mysql]# chkconfig --addmysqld  ……………………..加载至开机启动项,但目前还没有启动,只能下次生效启动

[root@burgess mysql]# chkconfig --listmysqld

mysqld            0:off    1:off    2:on     3:on     4:on     5:on     6:off

[root@burgess mysql]# service mysqldstart  ………………….手动启动

Starting MySQL...                                         [  OK  ] ls /mydata/data

[root@burgess mysql]# vim /etc/profile.d/mariadb.sh

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

[root@burgess mysql]#./etc/profile.d/mariadb.sh

[root@burgess mysql]# Echo $PATH

[root@burgess 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 currentinput statement.

MariaDB [(none)]>

 

更多详细内容参考官网https://mariadb.com/kb/en/mariadb/documentation/getting-started/binary-packages/installing-mariadb-binary-tarballs/


本文出自 “西来龙象” 博客,请务必保留此出处http://burgess8909.blog.51cto.com/9607271/1590832

Installing MariaDB Binary Tarballs

标签:mariadb binary tarballs

原文地址:http://burgess8909.blog.51cto.com/9607271/1590832

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!