广告
返回顶部
首页 > 资讯 > 数据库 >CentOS-6上安装二进制Mariadb
  • 302
分享到

CentOS-6上安装二进制Mariadb

2024-04-02 19:04:59 302人浏览 独家记忆
摘要

前言:    mariadb官方网站上提供了三种不同形式的程序包:源码包版、程序包管理器版、和二进制版,如下图所示。二进制版是由官方编译好的绿色版,相比源码包版安装更

前言:

    mariadb官方网站上提供了三种不同形式的程序包:源码包版、程序包管理器版、和二进制版,如下图所示。二进制版是由官方编译好的绿色版,相比源码包版安装更简单,比起程序包管理器版又多一点自由度,算是二者的折中方案。另外要注意它依赖于glibc,需要注意glibc的版本。

安装:

步骤一:

首先确认glibc版本,可以看到Centos-6上安装的是glibc-2.12版,所以需要下载

# rpm -q glibc
glibc-2.12-1.166.el6.x86_64

步骤二:

关闭iptables和SElinux


步骤三: 

# 创建系统用户Mysql

# useradd -r mysql

# 解压至目录/usr/local/

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

# 创建软链接mysql

# cd /usr/local/
# ln -sv mariadb-5.5.43-linux-x86_64/ mysql
"mysql" -> "mariadb-5.5.43-linux-x86_64/"

# 修改目录属主和属组

# chown -R root:mysql .

# 创建数据库目录。如果不单独创建并指定则默认使用当前目录下的data目录作为数据库目录

# mkdir -pv /data/mysql
mkdir: created directory `/data'
mkdir: created directory `/data/mysql'

# 修改数据库目录的属主和属组为mysql

# chown -R mysql:mysql /data/mysql/

# 安装数据库

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


配置

# 将bin目录路径导入PATH环境变量

# vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH

# 立即生效

# exec bash

# 创建头文件符号链接

# cd /usr/local/include/
# ln -s ../mysql/include/mysql/ mysql

# 将man路径导入系统man手册

# vim /etc/man.config
MANPATH /usr/local/mysql/man

# 拷贝服务脚本至/etc/rc.d/init.d目录

# cd /usr/local/mysql
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

# 复制模板配置文件至/etc/目录

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

# 修改配置文件

# vim /etc/my.cnf

字符集:

        mysqld为服务端,mysql为本地cli命令行工具,client为客户端连接工具包括远程连接工具等。均需要将字符集统一设置为utf-8,特殊场景根据实际情况修改为其他字符集。

[client]
default-charater-set=utf8
[mysql]
default-charater-set=utf8
[mysqld]
character-set-server=utf8


字符排序

[mysqld]
collation-server=utf8_general_ci


数据库目录

[mysqld]
datadir=/data/mysql


存储引擎

[mysqld]
# 默认使用innodb存储引擎
default-storage-engine=InnoDB
# 每张表都使用独立表空间
innodb-file-per-table=TRUE


关闭域名反解

skip-name-resolve=TRUE


配置完成后应该是这个样子

[client]
port            = 3306
Socket          = /tmp/mysql.sock
default-character-set=utf8

[mysqld]
datadir=/data/mysql
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
character-set-server=utf8
collation-server=utf8_general_ci
default-storage-engine=InnoDB
innodb-file-per-table=TRUE
skip-name-resolve=TRUE
log-bin=mysql-bin
skip-name-resolve=TRUE
log-bin=mysql-bin
binlog_fORMat=mixed
server-id       = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
default-character-set=utf8

[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


启动服务

/etc/init.d/mysqld start

开机自启动

chkconfig --add mysqld
chkconfig mysqld on

安全设置

# mysql_secure_installation 
/usr/local/mysql/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

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] n
 ... skipping.

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] n
 ... skipping.

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] 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.

# 删除test数据库以及访问它的权限设置
Remove test database and access to it? [Y/n] n
 ... skipping.

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!


您可能感兴趣的文档:

--结束END--

本文标题: CentOS-6上安装二进制Mariadb

本文链接: https://www.lsjlt.com/news/44631.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • CentOS-6上安装二进制Mariadb
    前言:    mariadb官方网站上提供了三种不同形式的程序包:源码包版、程序包管理器版、和二进制版,如下图所示。二进制版是由官方编译好的绿色版,相比源码包版安装更...
    99+
    2022-10-18
  • CentOS 7以通用二进制格式安装mariadb
    系统环境:CentOS 7 1611(系统安装完成后自带有mariadb)mariadb版本:mariadb-5.5.56-linux-x86_64.tar.gz(Generic Linux) &...
    99+
    2022-10-18
  • Centos 6.5如何使用二进制格式包安装MariaDB
    这篇文章主要讲解了“Centos 6.5如何使用二进制格式包安装MariaDB”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Centos 6.5如何使用二进...
    99+
    2022-10-18
  • Centos 7中安装二进制数据库mariadb最新版本
    一:实验背景;在马哥教育学习到MYSQL这章时,留作业练习的实验二:实验准备;1、先检查虚拟机上是否存在mariadb: rpm -qa   mariadb*,若有的话,则卸载;2、通过...
    99+
    2022-10-18
  • mariadb 5.5数据库二进制包在centos6.5上的安装
    1 解压二进制包到/usr/local/,并改名为mysql(mariadb目录必须是/usr/local/Mysql)tar -xf /var/ftp/pub/mariadb-5.5.56-linux-x...
    99+
    2022-10-18
  • 二进制安装mysql 5.7、mariadb (附yum安装方式)
     前言:        本文以mariadb为例进行讲解,安装mysql同理,并以通过测试。安装前查找系统已安装的相关包(rpm -qa|grep -e "mysql" -e "mariadb")并进行卸载...
    99+
    2022-10-18
  • CentOS7安装通用二进制格式MariaDB 10.2.8
    什么是MariaDBMariaDB 是MySql的一个分支。 了解一下数据库的发展历史,我们知道,MySql数据库不但二次易主,而且还被打入了冷宫(先被sun收购,然后sun被Oracle收购)。因为Ora...
    99+
    2022-10-18
  • 在CentOS 6.x上怎么安装docker
    本篇内容主要讲解“在CentOS 6.x上怎么安装docker”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“在CentOS 6.x上怎么安装docker”吧!1...
    99+
    2022-10-19
  • CentOS安装使用二进制方式mysql5.6笔记
    CentOS安装使用二进制方式mysql5.6笔记 1、上传安装包--使用root用户 2、解压安装包--使用root用户 cd /usr/local/ tar xzvf mysql-5.6....
    99+
    2022-10-18
  • Centos7中怎么使用二进制的方式安装MariaDB Server
    这篇文章主要介绍了Centos7中怎么使用二进制的方式安装MariaDB Server的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Centos7中怎么使用二进制的方式安装MariaDB Server文章都会有...
    99+
    2023-06-27
  • mysql学习笔记(4-通用二进制格式安装MariaDB)
    安装和使用MariaDB: 安装方式:     (1) rpm包;     (a) 由OS的发...
    99+
    2022-10-18
  • CentOS 6.9中如何进行二进制方式安装mysql5.7.21
    今天就跟大家聊聊有关CentOS 6.9中如何进行二进制方式安装mysql5.7.21,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。前言比 ...
    99+
    2022-10-18
  • 如何在CentOS 7 CPanel服务器上安装MariaDB 10
    这篇文章的内容主要围绕如何在CentOS 7 CPanel服务器上安装MariaDB 10进行讲述,文章内容清晰易懂,条理清晰,非常适合新手学习,值得大家去阅读。感兴趣的朋友可以跟随小编一起阅读吧。希望大家通过这篇文章有所收获!MariaD...
    99+
    2023-06-28
  • centos6上以二进制方式安装mariadb5.5
    准备mariadb-5.5.57-linux-x86_64.tar.gz二进制程序包此包是经过编译的,也就是说我们要在特定的目录下安装;步骤1、准备mysql用户mkdir /app/data#此目录是存放...
    99+
    2022-10-18
  • Percona MySQL 5.5 Linux通用二进制包安装(CentOS 6.9)
    创建软件安装目录 mkdir  /mysql_software_55 下载软件 Percona官网的下载页面有两个二进制Tar包,分别对应不同的发行版本 ssl100 - Debian/Ubun...
    99+
    2022-10-18
  • 在 CentOS 7 上安装 Apache、MySQL 8 或 MariaDB 10 和 PHP 7
    简介 CentOS 7 是一款流行的 Linux 发行版,以其稳定性和安全性而闻名。如果您想在 CentOS 7 上设置 Web 服务器,您可能需要安装 Apache、MySQL 或 MariaDB 以及 PHP。在这份综合指南中,我们将引...
    99+
    2023-10-22
  • mysql8.0 二进制安装
    博客只为记录学习过程。不喜勿喷mysql社区版:开源 免费,不提供技术支持,需要配合开源工具来使用。mysql企业版:和社区版本代码一样,通过插件提供额外功能特性,比社区版本增加线程插件,审计插件。等额外的...
    99+
    2022-10-18
  • mysql5.6.20二进制安装
    1把105的/usr/local/mysql拷过去2. 把105的/etc/my.cnf拷过去3. mkdir /data/mysql/{data,tmp,binlog,log}-p4. 初始化 ...
    99+
    2022-10-18
  • Mysql二进制安装
    Mysql安装安装步骤1、新建用户groupadd mysqluseradd -r -g mysql mysqlcd /usr/local/----------------------------注意路径c...
    99+
    2022-10-18
  • centos系统如何使用二进制包安装mysql 5.6
    本文主要给大家简单讲讲centos系统如何使用二进制包安装mysql 5.6 ,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望centos系统如何使...
    99+
    2022-10-18
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作