Mysql的cmake編譯與安裝 node
實驗準備環境: mysql
個人操做系統是centos6.6 sql
編譯安裝MariaDB以前,咱們須要準備一些須要的環境 vim
1.開發包組套件 centos
[root@node19 ~]# yum -y groupinstall "Development Tools" "Server Platform Development" 工具
2. 安裝上這個跨平臺的構建工具------cmake spa
[root@node19 ~]# yum -y install cmake 操作系統
ftp://172.16.0.1/pub/Sources/sources/mariadb 3d
lftp 172.16.0.1:/pub/Sources/sources/mariadb> mget mariadb-10.0.13.tar.gz orm
[root@node19 ~]# tar xf mariadb-10.0.13.tar.gz
建立全部者:所屬組爲 mysql
[root@node19 ~]# groupadd -r -g 306 mysql
[root@node19 ~]# useradd -r -g 306 -u 306 mysql
[root@node19 ~]# mkdir -pv /mydata/data
mkdir: created directory `/mydata'
mkdir: created directory `/mydata/data'
[root@node19 ~]# chown -R mysql.mysql /mydata/data
[root@node19 mariadb-10.0.13]# 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
[root@node19 mariadb-10.0.13]# make
[root@node19 mariadb-10.0.13]# make install
[root@node19 mysql]# pwd
/usr/local/mysql
修改當前目錄的所屬組
[root@node19 mysql]# chown -R root.mysql ./*
修改後的:
建立邏輯卷,過程本身總結(用做備份)
#掛載一個邏輯捲來實現一致性備份
物理層損壞恢復困難
#fdisk /dev/sda
p n p 3 +30G t 3 8e w
#partx -a /dev/sda
#pvcreate /dev/sda3
#vgcreate myvg /dev/sda3
#lvcreate -L 10G -n mylv myvg
#yum install xfsprogs
#mkfs -t xfs /dev/myvg/mylv
#vim /etc/fstab
/dev/myvg/mylv /mydata xfs defaults 0 0
#mount -a
#mount
執行初始化:
[root@node19 mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
[root@node19 mysql]# ls /mydata/data/
aria_log.00000001 aria_log_control ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema test
[root@node19 ~]# mkdir /etc/mysql
[root@node19 mysql]# cp support-files/my-large.cnf /etc/mysql/my.cnf
[root@node19 mysql]# vim /etc/mysql/my.cnf
#找到 thread_concurrency = 8 ,在其後面添加三行以下:
innodb_file_per_table = on
datadir = /mydata/data
skip_name_resolve = on
添加開機啓動項:
[root@node19 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@node19 mysql]# chmod +x /etc/rc.d/init.d/mysqld
[root@node19 mysql]# chkconfig --add /etc/init.d/mysqld
[root@node19 mysql]# service mysqld start
Starting MySQL. [ OK ]
[root@node19 mysql]# ss –tnl
給mariadb 添加環境變量,能夠使用tab路徑補全
增長着色的兩行:
[root@node19 mysql]# vim /etc/profile.d/mysql.sh
export MYSQL_HOME=/usr/local/mysql
export PATH=$MYSQL_HOME/bin:$PATH
[root@node19 mysql]# . /etc/profile.d/mysql.sh
以上mariadb的編譯安裝已經能夠告一段落啦