Centos 7源码安装mariadb10.4.13_mariadb10.4 aarh-程序员宅基地

技术标签: # mysql_mariadb_mongodb  mariadb  linux  mysql  数据库  centos  

一、环境

[root@localhost mariadb-10.4.13]# ifconfig |grep 192.168
        inet 192.168.1.107  netmask 255.255.255.0  broadcast 192.168.1.255
[root@localhost mariadb-10.4.13]# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)
[root@localhost mariadb-10.4.13]# uname -a
Linux localhost.localdomain 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

二、编译安装mariadb 10.4.16

1、安装阿里base及epel源
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
清缓存
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
2、安装软件环境支持
[root@localhost ~]# yum install -y boost gcc ncurses-devel libaio bison gcc-c++ git cmake ncurses-devel openssl openssl-devel  
3、下载mariadb10.4.16源码包
[root@localhost ~]# cd /usr/src/
[root@localhost ~]# wget -c [root@localhost src]# wget -c https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.4.13/source/mariadb-10.4.13.tar.gz
解压
[root@localhost src]# tar -zxvf mariadb-10.4.13.tar.gz
[root@localhost src]# cd mariadb-10.4.13/
预编译
[root@localhost mariadb-10.4.13]# cmake -j4 . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DMYSQL_DATADIR=/data/mariadb/ \
-DSYSCONFDIR=/usr/local/mariadb \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITHOUT_TOKUDB=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
编译
[root@localhost mariadb-10.4.13]# make -j4
安装
[root@localhost mariadb-10.4.13]# make install -j4
查看安装目录
[root@localhost mariadb-10.4.13]# ls /usr/local/mariadb/
bin      CREDITS  EXCEPTIONS-CLIENT  INSTALL-BINARY  man         README.md     scripts  sql-bench      THIRDPARTY
COPYING  data     include            lib             mysql-test  README-wsrep  share    support-files
4、配置启动文件及权限等
[root@localhost mariadb-10.4.13]# cd /usr/local/mariadb/
[root@localhost mariadb]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mariadb]# chmod +x /etc/init.d/mysqld
[root@localhost mariadb]# mkdir -p /data/mariadb/
[root@localhost mariadb]# chown -R mysql. /data/mariadb
[root@localhost mariadb]# chown -R mysql:mysql /usr/local/mariadb/
5、配置数据库主配置文件
[root@localhost mariadb]# vim /usr/local/mariadb/my.cnf
[mysqld]
basedir=/usr/local/mariadb/
datadir=/data/mariadb/
port=3306
pid-file=/data/mariadb/mysql.pid
socket=/tmp/mysql.sock

[mysqld_safe]
log-error=/data/mariadb/mysql.log

[client]
port=3306
socket=/tmp/mysql.sock
default-character-set=utf8
6、数据库初始化
[root@localhost mariadb]# /usr/local/mariadb/scripts/mariadb-install-db --datadir=/data/mariadb/ 
Installing MariaDB/MySQL system tables in '/data/mariadb/' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is root@localhost, it has no password either, but
you need to be the system 'root' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '.' ; ./bin/mysqld_safe --datadir='/data/mariadb/'

You can test the MariaDB daemon with mysql-test-run.pl
cd './mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
7、安装目录权限改回root
[root@localhost mariadb]# chown -R root. /usr/local/mariadb/
8、数据目录权限改为mysql
[root@localhost mariadb]# chown -R mysql:mysql /data/mariadb/
[root@localhost mariadb]# ll /data/mariadb/                  
total 110628
-rw-rw---- 1 mysql mysql    24576 Jun 28 20:16 aria_log.00000001
-rw-rw---- 1 mysql mysql       52 Jun 28 20:16 aria_log_control
-rw-rw---- 1 mysql mysql      972 Jun 28 20:16 ib_buffer_pool
-rw-rw---- 1 mysql mysql 12582912 Jun 28 20:16 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Jun 28 20:16 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Jun 28 20:16 ib_logfile1
drwx------ 2 mysql mysql     4096 Jun 28 20:16 mysql
drwx------ 2 mysql mysql       20 Jun 28 20:16 performance_schema
drwx------ 2 mysql mysql       20 Jun 28 20:16 tes
9、启动及登录mariadb
启动
[root@localhost mariadb]# /etc/init.d/mysqld start
Reloading systemd:                                         [  OK  ]
Starting mysqld (via systemctl): 
查看进程
[root@localhost mariadb]# ps -ef|grep mysql
root     25543     1  0 20:19 ?        00:00:00 /bin/sh /usr/local/mariadb//bin/mysqld_safe --datadir=/data/mariadb/ --pid-file=/data/mariadb/mysql.pid
mysql    25637 25543  0 20:19 ?        00:00:00 /usr/local/mariadb/bin/mysqld --basedir=/usr/local/mariadb/ --datadir=/data/mariadb/ --plugin-dir=/usr/local/mariadb//lib/plugin --user=mysql --log-error=/data/mariadb/mysql.log --pid-file=/data/mariadb/mysql.pid --socket=/tmp/mysql.sock --port=3306
root     25674  2628  0 20:20 pts/0    00:00:00 grep --color=auto mysql
登录
[root@localhost mariadb]# /usr/local/mariadb/bin/mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.4.13-MariaDB Source distribution

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

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

MariaDB [(none)]>
10、数据安全配置
[root@localhost mariadb]# /usr/local/mariadb/bin/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
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the 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.

Disallow root login remotely? [Y/n] n
 ... skipping.

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.

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!
[root@localhost mariadb]# 
11、配置环境变量
配置变量脚本
[root@localhost mariadb]# echo "export PATH=/usr/local/mariadb/bin:$PATH" >/etc/profile.d/mariadb.sh
执行脚本
[root@localhost mariadb]# . /etc/profile.d/mariadb.sh 
就可以直接以mysql登录了
[root@localhost mariadb]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 10.4.13-MariaDB Source distribution

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

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

MariaDB [(none)]>

--------------------end

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/oToyix/article/details/107006809

智能推荐

(最新最详细)安装ubuntu18.04-程序员宅基地

文章浏览阅读2w次,点赞4次,收藏91次。目录1. window10中下载ubuntu镜像2. 制作U盘启动盘3. Ubuntu 分配硬盘空间1. window10中下载ubuntu镜像下载地址2. 制作U盘启动盘安装制作工具:UltraISO(点我下载),下载完成后安装插入用来做启动盘的U盘(最好是usb3.0接口,16GB或以上),并清空里面的文件打开安装好的UltraISO,点击继续试用按钮工作界面进入工作界面后,点击菜单栏文件(F),在弹出的选项卡里点击打开在弹出的文件选择对话框中找到下载好的 Ubuntu18.04._ubuntu18.04

Toad报“No valid Oracle Client found”错-程序员宅基地

文章浏览阅读203次。2019独角兽企业重金招聘Python工程师标准>>> ..._toad no valid oracle client

MySQL数据库入侵及防御方法-程序员宅基地

文章浏览阅读521次。来自:http://blog.51cto.com/simeon/1981572作者介绍陈小兵,高级工程师,具有丰富的信息系统项目经验及18年以上网络安全经验,现主要从事网络安全及数据库技术研究工作。《黑客攻防及实战案例解析》《Web渗透及实战案例解析》《安全之路-Web渗透及实战案例解析第二版》《黑客攻防实战加密与解密》《网络攻防实战研究:漏洞利用与提权》作者,在国内多本学术期..._mysql 5.0.16入侵

SQL Server SSMS历史版本下载地址-程序员宅基地

文章浏览阅读135次。https://learn.microsoft.com/zh-cn/sql/ssms/release-notes-ssms?view=sql-server-ver16#previous-ssms-releases_sql server历史版本哪儿下

【狂神JAVA】MyBatis笔记_jdk1.7的mybatis-程序员宅基地

文章浏览阅读2.5k次。简介自学的【狂神JAVA】MyBatis分享自写源码和笔记,希望对大家有帮助本人配置jdk13.0.2 (jdk1.7以上均可)Maven 3.6.3MySQL 5.7.23 (mysql5.6以上均可)1. 配置官网文档: https://mybatis.org/mybatis-3/zh/getting-started.htmlpom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://_jdk1.7的mybatis

学习笔记---分布式调度之xxlJob调度中心的启动源码解析_xxl 调度失败:执行器地址为空-程序员宅基地

文章浏览阅读913次。调度中心的代码启动源码是从:XxlJobAdminConfig 入口;直接进入: xxlJobScheduler.init();第一个: initI18n() 处理国际化;第二个:JobRegistryMonitorHelper.getInstance().start(); 创建启动后台线程来维护在线的执行器组下的机器列表,从上篇学习笔记—分布式调度之xxlJob执行器的启动源码解析可以..._xxl 调度失败:执行器地址为空

随便推点

数据结构实验5《基于哈夫曼树的数据压缩》_基于哈夫曼树的数据压缩算法c语言-程序员宅基地

文章浏览阅读2k次,点赞4次,收藏25次。(visual studio 2019可运行)输入及输出要求见《数据结构C语言(第二版)》严蔚敏版【本文仅用于啥都看不懂还想交作业选手】#include<iostream>#include<map>#include<string>#include<stdio.h>#include<memory.h>using namespace std;typedef struct{ char c; int weight; in_基于哈夫曼树的数据压缩算法c语言

Teams Bot App 代码解析_adaptivecards.declare<datainterface>(rawlearncard)-程序员宅基地

文章浏览阅读1w次。Teams Bot App 代码解析_adaptivecards.declare(rawlearncard).render(this.likecountobj)

Unity UGUI(三)RawImage(原始图像)_unity原始图像-程序员宅基地

文章浏览阅读2.5k次。RawImage(Script)Texture 纹理 要显示的图片,注意:图片类型可以是任何类型 Color 颜色 图片的主颜色 Material 材质 渲染材质 Raycast Target 光线投射目标 是否可接收射线碰撞事件检测 UV Rect UV矩形 显示效果:X、Y属性用于控制纹理左右..._unity原始图像

SpringBoot与分布式事务组件-程序员宅基地

文章浏览阅读2k次。随着互联网应用的复杂性增加,越来越多的公司选择使用微服务架构模式进行应用开发,将单体应用拆分成多个小型服务,每个服务部署在不同的服务器上。同时,为了提升系统的可用性、容错性和可扩展性,需要考虑分布式事务问题。本文将介绍 Spring Boot 在分布式事务中的一些实现方案,并给出相关原理。

小程序基础入门(黑马学习笔记)_黑马微信小程序笔记-程序员宅基地

文章浏览阅读2.8k次,点赞12次,收藏90次。权当学习笔记吧_黑马微信小程序笔记

SpringBoot的旅游网站的设计与实现 - 源码免费(私信领取)

采用Spring Boot框架进行后端开发,结合前端技术(如Vue.js、React等)进行页面设计,数据库采用MySQL进行数据存储,确保系统的稳定性和性能。本项目旨在设计并实现一个基于Spring Boot的旅游网站,为用户提供便捷的旅游信息查询、预订服务,以及旅游资讯分享功能,提升用户旅游体验。通过市场调研和用户需求分析,了解用户对旅游网站的需求和偏好,明确系统的功能和特点,确保系统能够满足用户的旅游需求。进行全面的系统测试,包括功能测试、性能测试、安全性测试和用户体验测试,确保系统的质量和可靠性。