文档章节

CentOS 7 下 MariaDB 10 Yum Install安装

编程码农
 编程码农
发布于 2017/01/20 12:24
字数 661
阅读 175
收藏 0

Linux 系统信息

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core) 
[root@localhost ~]# uname
Linux
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

获取Mariadb包源

来自官网的包源 https://downloads.mariadb.org/mariadb/repositories/

[root@localhost ~]# vim /etc/yum.repos.d/MariaDB.repo

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2.1/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

安装

安装之前确保机器上面没有YUM安装的MySQL、Mariadb

[root@localhost ~]#  rpm -qa | grep -i mysql
[root@localhost ~]#  rpm -qa | grep -i mari
[root@localhost ~]# 
yum remove $(rpm -qa | grep -i mysql )
yum remove $(rpm -qa | grep -i mari )
yum install MariaDB-server MariaDB-client

启动Mariadb

查看自启动服务
chkconfig --list | grep -i mysql/mariadb  
删除服务
chkconfig --del mysqld  

systemctl start mysql.service
systemctl enable mysql.service

选用合适的配置文件

MariaDB会给我们提供示例配置文件,根据机器内存进行选择,稍作修改即可使用。

ls /usr/share/mysql/my-*
/usr/share/mysql/my-huge.cnf             /usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-innodb-heavy-4G.cnf  /usr/share/mysql/my-small.cnf
/usr/share/mysql/my-large.cnf
配置文件
cp  /usr/share/mysql/my-huge.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y

重载配置文件

systemctl reload mysql.service

 

启动服务

service mysql start  

设置root密码

1.使用命令mysql_secure_installation

运行 mysql_secure_installation 设置root用户密码、去除test数据库、禁止root帐号远程访问等。推荐

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.

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.

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.

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.

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!

修改Mariadb数据套接字

[root@localhost ~]# vim /etc/my.cnf
# The following options will be passed to all MariaDB clients
[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MariaDB server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock

 

 

 

 

 

 

© 著作权归作者所有

共有 人打赏支持
编程码农
粉丝 1
博文 19
码字总数 13170
作品 0
杭州
后端工程师
私信 提问
CentOS 6.4 安装 MariaDB 10.3

本文介绍如何使用yum在CentOS 6.4 安装 MariaDB 10.3 1. 创建mysql组 groupadd mysql 2. 创建mysql用户并添加到mysql组 useradd -g mysql mysql 3.修改mysql密码 passwd mysql 4. 配置 Mari...

易语随风去
2018/06/01
0
0
使用RPM包离线安装MariaDB 10.0.20 , 基于CentOS 6.6-x86-64

使用RPM包[离线]安装 MariaDB 10.0.20,基于CentOS 6.6-x86-64 Minimal 湘中朱生 2015-07-01 于深圳福田 QQ: 872007255 MariaDB交流群: 198111730 文档说明: 1. 网上有很多关于MariaDB/Mysql...

湘中朱生
2015/07/04
0
1
CentOS 7.4 yum方式搭建LNMP环境,部署WordPress博客,并安装XCache模块

一、演示环境: 备注:CentOS 7.4已经不再内置mysql-server程序包 二、搭建LNMP: 1、安装前准备: (1)校对服务器时间 (2) 配置epel源 2、安装nginx:# yum -y install nginx # systemct...

Marion0728
2018/04/18
0
0
Install Apache, PHP And MySQL On CentOS 7 (LAMP)

Install Apache, PHP And MySQL On CentOS 7 (LAMP) This tutorial shows how you can install an Apache2 webserver on a CentOS 7.0 server with PHP5 support (mod_php) and MySQL suppor......

lg070224
2018/07/04
0
0
Install Apache, PHP And MySQL On CentOS 7 (LAMP)

Install Apache, PHP And MySQL On CentOS 7 (LAMP) This tutorial shows how you can install an Apache2 webserver on a CentOS 7.0 server with PHP5 support (mod_php) and MySQL suppor......

lg070224
2018/07/04
0
0

没有更多内容

加载失败,请刷新页面

加载更多

编码规范

4.、编码时的一些建议 1、尽量指定类、方法的final修饰符——虚拟机会想办法内联所有的final方法来减少方法执行时创建栈帧的数量,从而降低栈溢出的风险 2、尽量重用对象——重复new对象会增...

呵呵哒灬
23分钟前
2
0
第一个docker化的java应用

Docker 思想 集装箱 标准化:运输方式/存储方式/API 接口 隔离

BeanHo
23分钟前
1
0
数据库技术-Mysql主从复制与数据备份

数据库技术-Mysql 主从复制的原理: MySQL中数据复制的基础是二进制日志文件(binary log file)。一台MySQL数据库一旦启用二进制日志后,其作为master,它的数据库中所有操作都会以“事件”...

须臾之余
昨天
13
0
Git远程仓库——GitHub的使用(一)

Git远程仓库——GitHub的使用(一) 一 、 Git远程仓库 由于你的本地仓库和GitHub仓库之间的传输是通过SSH加密的,所以需要一下设置: 步骤一、 创建SSH key 在用户主目录下,看看有没有.ss...

lwenhao
昨天
4
0
SpringBoot 整合

springBoot 整合模板引擎 SpringBoot 整合Mybatis SpringBoot 整合redis SpringBoot 整合定时任务 SpringBoot 整合拦截器...

细节探索者
昨天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部