linux服务基础之CentOS6编译安装mariadb

1. 下载mariadb:https://downloads.mariadb.org/mariadb/+releases/

2. 解压到指定目录

# tar xf mariadb-5.5.-linux-x86_64.tar.gz -C /usr/local

# cd /usr/local
# ln -sv mariadb-5.5.43-linux-x86_64/ mysql # groupadd -r mysql
# useradd -r -g mysql mysql
# cd mysql
# chown -R :mysql ./*

3. 使用xfs文件格式存放mariadb数据

# pvcreate /dev/sdb1
# vgcreate myvg /dev/sdb1
# lvcreate -L 6G -n mylv myvg  //创建逻辑卷
# yum install xfsprogs
# modprobe xfs
# mkfs.xfs /dev/myvg/mylv  //格式化文件格式 # vim /etc/fstab
    添加:/dev/myvg/mylv /mydata xfs defaults  //开机挂载 
# mount -a # mkdir /mydata/data  //用于存放mysql数据
# chown /mydata/data

4. 配置

# scripts/mysql_install_db --user=mysql --datadir=/mydata/data  //安装mysql元数据的数据库
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld  //添加mysql服务脚本
# chkconfig --add mysqld
# mkdir /etc/mysql
# cp support-files/my-large.cnf /etc/mysql/my.cnf  //添加配置文件
        添加三个选项
datadir= /mydata/data
innodb_file_per_table = on
skip_name_resolve = on
# ln /usr/local/mysql/bin/mysql /usr/bin  //添加客户端执行程序

5. 运行mysql

# service mysqld start
# mysql //登录mysql
> USE mysql
> SELECT User,Host,Passwrod from user;
> exit

5. 执行mysql安全初始化程序

# /usr/local/mysql/bin/mysql_secure_installation   //添加root账号,删除匿名用户等

6.登录mysql

# mysql -uroot -palen
上一篇:Python中的socket网络编程(TCP/IP,UDP)讲解


下一篇:UNIX网络编程——TCP/IP简介