1. 程式人生 > >MariaDBa安裝備忘

MariaDBa安裝備忘

mysql lar touch x86_64 dev mar usr service pad

(1)準備數據目錄

# fdisk -l
# fdisk /dev/sdb
# pvcreate /dev/sdb1
# vgs
# vgcreate yuyang /dev/sdb1
# lvcreate -L 10G -n mydata yuyang
# yum install xfsprogs
# modprobe xfs
# mkfs.xfs /dev/yuyang/mydata
# mkdir /mydata
# vim /etc/fstab
    #添加
    /dev/yuyang/mydata      /mydata                 xfs     defaults        0 0 
# mount -a
# cd /mydata/
# mkdir data
# chown mysql.mysql data

(2)安裝mariadb

# groupadd -r mysql
# useradd -r -g mysql mysql
# tar xf mariadb-5.5.59-linux-x86_64.tar.gz -C /usr/local/
# cd /usr/local/
# ln -sv mariadb-5.5.59-linux-x86_64/ mysql
# cd mysql/
# chown -R root:mysql ./*
# scripts/mysql_install_db --help
# scripts/mysql_install_db --user=mysql --datadir=/mydata/data
# echo ‘PATH=/usr/local/mysql/bin:$PATH‘ > /etc/profile.d/mysqld.sh

(3)準備配置文件

# mkdir /etc/mysql
# cd mysql/
# cd support-files/
# cp my-large.cnf /etc/mysql/my.cnf
# vim /etc/mysql/my.cnf 
  #添加:
    innodb_file_per_table = on
    skip_name_resolve = on

(4)啟動服務

touch /var/log/mysqld.log
chown mysql.mysql /var/log/mysqld.log 
service mysqld start
ss -tanl

MariaDBa安裝備忘