您的位置:首页 > 数据库 > MariaDB

LAMP架构介绍 MySQL_MariaDB介绍 MySQL安装 MariaDB安装

2018-02-27 11:36 1096 查看
11.1 LAMP架构介绍



11.2 MySQL_MariaDB介绍

MySQL是一个关系型数据库,由mysql ab公司开发,mysql在2008年被sun公司收购(10亿刀),2009年sun公司被oracle公司收购(74亿刀)

MySQL官网https://www.mysql.com 最新版本5.7GA/8.0DMR

MySQL5.6变化比较大,5.7性能上有很大提升

Mariadb为MySQL的一个分支,官网https://mariadb.com/最新版本10.2

MariaDB主要由SkySQL公司(现更名为MariaDB公司)维护,SkySQL公司由MySQL原作者带领大部分原班人马创立.

Mariadb5.5版本对应MySQL的5.5,10.0对应MySQL5.6

Community 社区版本,Enterprise 企业版,GA(Generally Available)指通用版本,在生产环境中用的,DMR(Development Milestone Release)开发里程碑发布版,RC(Release Candidate)发行候选版本,Beta开放测试版本,Alpha内部测试版本

11.3 MySQL安装

# cd /usr/local/src/

# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
# tar -zxf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

# mv mysql-5.6.36-linux-glibc2.5-x86_64 ../mysql

# cd ../mysql

# useradd mysql

# mkdir /data/

# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:

Data::Dumper

# yum list | grep -i perl | grep -i dumper

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

per
4000
l-Data-Dumper.x86_64 2.145-3.el7 base

perl-Data-Dumper-Concise.noarch 2.020-6.el7 epel

perl-Data-Dumper-Names.noarch 0.03-17.el7 epel

perl-XML-Dumper.noarch 0.81-17.el7 base

# yum install -y perl-Data-Dumper

# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

# echo $?

0

# cp support-files/my-default.cnf /etc/my.cnf

cp:是否覆盖"/etc/my.cnf"? n

# vim /etc/my.cnf

# grep -v '#' my.cnf

[mysqld]

datadir=/data/mysql

socket=/tmp/mysql.sock

symbolic-links=0

[mysqld_safe]

#

# cp support-files/mysql.server /etc/init.d/mysqld

# vim /etc/init.d/mysqld

定义basedir和datadir

# chkconfig --add mysqld

# chkconfig --list

# /etc/init.d/mysqld start

Starting MySQL.... SUCCESS!

# /etc/init.d/mysqld stop

Shutting down MySQL.. SUCCESS!

# service mysqld start

Starting MySQL... SUCCESS!

# service mysqld stop

Shutting down MySQL.. SUCCESS!

# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysql &

[1] 5070

# 180227 11:04:16 mysqld_safe Logging to '/data/mysql/aminglinux-01.err'.

180227 11:04:16 mysqld_safe Starting mysqld daemon with databases from /data/mysql

#

# killall mysqld

# ps aux | grep -i mysql

root 3973 0.0 0.0 107904 664 pts/1 S+ 10:53 0:00 tailf /data/mysql/aminglinux-01.err

root 5662 0.0 0.0 112680 1000 pts/0 S+ 11:29 0:00 grep --color=auto -i mysql

mysql5.7 二进制包安装

# cd /usr/local/src/

# wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
# tar -zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

# mv mysql-5.7.18-linux-glibc2.5-x86_64 ../mysql-5.7.18

11.6 MariaDB安装

# cd /usr/local/src

# wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
# tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz

# mv mariadb-10.2.6-linux-glibc_214-x86_64/ ../mariadb

# cd ../mariadb/

# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb

# echo $?

0

# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf

# vim my.cnf

[mysqld]

datadir = /data/mariadb

# cp support-files/mysql.server /etc/init.d/mariadb

# vim /etc/init.d/mariadb

basedir=/usr/local/mariadb

datadir=/data/mariadb

conf=$basedir/my.cnf

$bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &

# killall mysqld

# /etc/init.d/mariadb start

Reloading systemd: [ 确定 ]

Starting mariadb (via systemctl): [ 确定 ]

# ps aux | grep mariadb

root 1905 0.1 0.1 115388 1728 ? S 15:09 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/aminglinux-01.pid

mysql 2021 6.5 5.6 1583876 56828 ? Sl 15:09 0:02 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mysql --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mysql/aminglinux-01.err
--pid-file=/data/mysql/aminglinux-01.pid --socket=/tmp/mysql.sock --port=3306

root 2066 0.0 0.0 112676 984 pts/0 S+ 15:10 0:00 grep --color=auto mariadb

# netstat -lntp | grep 3306

tcp6 0 0 :::3306 :::* LISTEN 2021/mysqld
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux