Centos7 MariaDB10.1.22编译安装

当前系统环境

# hostnamectl

Static hostname: localhost.localdomain

Icon name: computer-vm

Chassis: vm

Machine ID: 2db9c42fe2974c44a4d53161c3cd9fb4

Boot ID: b9a685bd7d9e47eaaa5a742712c930ac

Virtualization: vmware

Operating System: CentOS Linux 7 (Core)

CPE OS Name: cpe:/o:centos:centos:7

Kernel: Linux 3.10.0-514.10.2.el7.x86_64

Architecture: x86-64

# cat /etc/redhat-release

CentOS Linux release 7.3.1611 (Core)

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

官方下载地址:

https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.22/source/mariadb-10.1.22.tar.gz

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

1、首先查询下是否安装了mysql或者旧版本mariadb

rpm -qa | grep mysql

删除rm -rf /etc/my.cnf

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

2、安装依赖包

#  yum install  -y  libevent

# yum groupinstall -y Development Tools

# yum install -y ncurses-devel openssl-devel openssl

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

3、创建数据库用户及组

#groupadd mysql

#useradd mysql -s /sbin/nologin -g mysql -M mysql

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

4、创建数据库数据存放目录及赋予权限

#mkdir /appliction/mydata -p

#chown mysql.mysql /appliction/mydata -R

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

一、编译安装开始

1、解压

#tar zxf mariadb-10.1.22.tar.gz

#cd mariadb-10.1.22

#cmake . -DCMAKE_INSTALL_PREFIX=/appliction/mysql \      //安装目录

-DMYSQL_DATADIR=/appliction/mydata \      //数据库存放目录

-DWITH_INNOBASE_STORAGE_ENGINE=1 \       //支持数据库innobase引擎

-DWITH_ARCHIVE_STORAGE_ENGINE=1 \       //支持数据库archive引擎

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \     //支持数据库blackhole存储引擎

-DWITH_READLINE=1 \

-DWITH_SSL=system \

-DWITH_ZLIB=system \

-DWITH_LIBWRAP=0 \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \             //字符集utf8

-DDEFAULT_COLLATION=utf8_general_ci \    //校验字符

-DENABLED_LOCAL_INFILE=1             //允许本地导入数据

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

#make -j4

#make install

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

2、配置MariaDB

#cd /appliction/mysql

#scripts/mysql_install_db --user=mysql --datadir=/appliction/mydata

#ls /appliction/mydata  (此目录原是空目录)

total 110616

16 -rw-rw----. 1 mysql mysql  16384 Mar 27 16:17  aria_log.00000001

4 -rw-rw----. 1 mysql mysql  52 Mar 27 16:17    aria_log_control

12288 -rw-rw----. 1 mysql mysql   12582912 Mar 27 16:17 ibdata1

49152 -rw-rw----. 1 mysql mysql   50331648 Mar 27 16:17 ib_logfile0

49152 -rw-rw----. 1 mysql mysql   50331648 Mar 27 16:17 ib_logfile1

4 drwx------. 2 mysql root  4096 Mar 27 16:17    mysql

0 drwx------. 2 mysql mysql  20 Mar 27 16:17    performance_schema

0 drwx------. 2 mysql root   6 Mar 27 16:17    test

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

3、删除my.cnf

# rm -rf /etc/my.cnf

# rm -rf /etc/my.cnf.d

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

4、复制配置文档

#cd /appliction/mysql/support-files/

#cp my-large.cnf /etc/my.cnf

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

4、创建启动脚本

# cd /appliction/mysql/support-files/

# cp mysql.server /etc/rc.d/init.d/mysqld

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

5、配置环境变量,方便直接输入mysql

# cat /etc/profile.d/mysql.sh

MYSQL_HOME=/appliction/mysql

export PATH=$MYSQL_HOME/bin:$PATH

#source /etc/profile.d/mysql.sh

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

6、启动数据库

# /etc/rc.d/init.d/mysqld start

Reloading systemd:               [  OK  ]

Starting mysqld (via systemctl):      [  OK  ]

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

7、登陆数据库,不需要密码

# mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 4

Server version: 10.1.22-MariaDB Source distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]>

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

8、初始化数据库,此方式可以禁用空密码登陆,按照提示输入你需要的Y或者N

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we‘ll need the current

password for the root user.  If you‘ve just installed MariaDB, and

you haven‘t set the root password yet, the password will be blank,

so you should just press enter here.

#输入当前root账号数据库密码,现在为空

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

#设置root密码

Set root password? [Y/n] y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

#是否移除匿名用户

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connect from ‘localhost‘.  This

ensures that someone cannot guess at the root password from the network.

#是否禁止root用户远程登陆

Disallow root login remotely? [Y/n] y

... Success!

By default, MariaDB comes with a database named ‘test‘ that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.

#是否移除test数据库

Remove test database and access to it? [Y/n] y

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

#是否现在重新加载授权信息

Reload privilege tables now? [Y/n] Y

... Success!

Cleaning up...

All done!  If you‘ve completed all of the above steps, your MariaDB

installation should now be secure.

Thanks for using MariaDB!

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

9、设置mysql本地方式免密码登陆

# egrep -v "^$|#" /etc/my.cnf  (增加了红色部分)

[client]

port= 3306

socket= /tmp/mysql.sock

[mysqld]

port= 3306

socket= /tmp/mysql.sock

skip-external-locking

key_buffer_size = 256M

max_allowed_packet = 1M

table_open_cache = 256

sort_buffer_size = 1M

read_buffer_size = 1M

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size= 16M

thread_concurrency = 8

log-bin=mysql-bin

binlog_format=mixed

server-id= 1

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

user = root

password = 123456

host = 127.0.0.1

[myisamchk]

key_buffer_size = 128M

sort_buffer_size = 128M

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

#----------------------------------分隔符---------------------------------------------#

注意事项:

若是重新安装需要make clean 及 rm CMAKECache.txt

时间: 2024-11-05 15:12:32

Centos7 MariaDB10.1.22编译安装的相关文章

mysql5.5.22编译安装

mysql5.5.22编译安装 一.准备工作 (1)干净的centos6.7系统(这个是本人的测试环境) (2)准备两个包:cmake-2.5.6.tar.gz和mysql5.5.22.tar.gz (3)把需要的包都放到/usr/local/src目录,如果不想用winscp把包放到Linux系统,可以在Linux上安装rz.方法如下: 查看rz包是哪个: yum provides "*/bin/rz" 安装rz包,可以用tab补全命令 yum -y install lrzsz.x8

LAMP——httpd 2.4.20 + mysql-5.6.26 + php-5.6.22编译安装过程

httpd 2.4.20 + mysql-5.6.26 + php-5.6.22编译安装过程: 资源准备 系统:centos6.5 PHP:wget http://docs.php.net/distributions/php-5.6.22.tar.gz MySQL:wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.26.tar.gz APACHE:wget http://mirrors.noc.im/apache//httpd/http

CentOS7.4 源码编译安装LNMP

1.基于CentOS7.4源码编译安装得lnmp 系统环境CentOS 7.4 系统最小化安装,只安装了一些常用包(vim.lirzs.gcc*.wget.bash-completion) nginx版本1.14.0 mysql版本5.7.20 php版本7.2.6 1.1 下载网络yum源 [[email protected]_4 ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo -P /etc/yum.repos.d/    #这里安

mariadb-10.1.22mariadb编译安装

官方下载地址: https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.22/source/mariadb-10.1.22.tar.gz 1.首先查询下是否安装了mysql或者旧版本mariadb rpm -qa | grep mysql 删除rm -rf /etc/my.cnf 2.安装依赖包 #  yum install  -y  libevent # yum groupinstall -y Development Tools #

在Centos7上实现手工编译安装mysql5.7

实验环境:Centos7版本一台,实验所需用的安装包和脚本都在下面的链接中. 链接: https://pan.baidu.com/s/1a6x5MahQk8_HpSyiH7QpUw 密码: paqj 操作步骤 首先我们需要安装编译环境 解压两个安装包,这里的boost包需要解压到指定的目录下,mysql5.7这个数据包则随便. 创建一个mysql的管理用户来管理 手工编译安装 把mysql这个目录的用户和组更改为新创建的用户 进入配置文件修改里面的内容 对配置文件进行修改用户和组 运行数据库并查

centos7下mysql5.7编译安装

mysql5.5以后,mysql的编译安装开始采用cmake的方式,使编译能够独立与源码之外工作,同时,编译版本的mysql兼容性非常好,而且易于卸载和移植到其他服务器上使用,本文讲述mysql5.7的编译安装过程:??准备工作 mysql安装包:mysql-5.7.19.tar.gz编译依赖包: boost_1_59_0.tar.gz 安装环境:centos7服务器,磁盘大小20G左右,内存2G或以上 ??建立用户与组 groupadd -g 27 mysqluseradd -u 27 -g

CentOS7.6源码编译安装PHP 7.3.8

安装步骤 PHP官网下载链接:https://www.php.net/downloads.php 1. 使用wget命令下载源码安装包 wget https://www.php.net/distributions/php-7.3.8.tar.gz --no-check-certificate [说明]如果报SSL Certification错误信息的话,就加上 --no-check-certificate选项,一般不需要添加. 2. 解压.tar.gz文件 tar -xzvf php-7.3.8

学习笔记 ————centos7.4下php编译安装

PHP(外文名:PHP: Hypertext Preprocessor,中文名:"超文本预处理器")是一种通用开源脚本语言.语法吸收了C语言.Java和Perl的特点,利于学习,使用广泛,主要适用于Web开发领域.PHP 独特的语法混合了C.Java.Perl以及PHP自创的语法.它可以比CGI或者Perl更快速地执行动态网页.用PHP做出的动态页面与其他的编程语言相比,PHP是将程序嵌入到HTML(标准通用标记语言下的一个应用)文档中去执行,执行效率比完全生成HTML标记的CGI要高

学习笔记-centos7.4下mysql编译安装

编译安装MySQL 注释:编译mysql的时候会比较耗资源,建议在虚拟机下把内存提升到1-2G MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Oracle 旗下产品.MySQL 是最流行的关系型数据库管理系统之一,在 WEB 应用方面,MySQL是最好的 RDBMS (Relational Database Management System,关系数据库管理系统) 应用软件.MySQL是一种关系数据库管理系统,关系数据库将数据保存在不同的表中,而不是将所有数据