yum安装Mariadb,二进制安装Mariadb

yum安装Mariadb

设置Mariadb的yum源

vim /etc/yum.repos.d/mariadb.repo  
[mariadb]
name=mariadb
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.2/centos7-amd64/
gpgcheck=0

使用清华yum源安装Mariadb,可以选择不同的版本,此处安装10.2.23
yum install mariadb-server

二进制安装Mariadb

1 准备mysql用户和组

groupadd -r -g 336 mysql      #创建mysql组
useradd -r -g mysql -u 336 -s /sbin/nologin -d /data/mysql mysql  #创建mysql用户,并加入mysql用户组,设置UID为336,设置默认shell为nologoin,家目录为/data/mysql 但不自动创建

2 准备二进制程序文件和相关文件属性

tar xvf mariadb-10.2.23-linux-x86_64.tar.gz -C /usr/local   #只能放在此目录中
cd /usr/local/
ln -s mariadb-10.2.23-linux-x86_64/ mysql                   #建立软件链接,方便使用
chown -R root.root /usr/local/mysql/                        #设置属主和属组为root用户和root组

3 PATH变量

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

4 准备数据库数据目录和数据(使用逻辑卷)

创建逻辑卷
pvcreate /dev/sda6
创建卷组
vgcreate vg0 /dev/sda6
创建逻辑卷
lvcreate -n mysql -L 20G /dev/vg0
创建文件系统并挂载到/data/mysql
mkfs.xfs /dev/vg0/mysql
mkdir /data/mysql
mount /dev/vg0/mysql /data/mysql
chown mysql.mysql /data/mysql/
cd /usr/local/mysql
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql #安装mysql到/data/mysql目录下,用户为mysql

5 准备Mysql的服务器端配置文件

mkdir /etc/mysql  
cp /usr/local/mysql/support-files/my-huge.cnf /etc/mysql/my.cnf  
vim /etc/mysql/my.cnf  
[mysqld]
datadir=/data/mysql   #设置目录为/data/mysql

6 准备服务启动脚本

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
service mysqld start

7 安全加固

[root@Centos7 ~]#/usr/bin/mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS 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     #设置root用户密码
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  #禁止root远程登录... 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    #删除测试数据库test- 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!

8 测试连接
mysql -uroot -pPASSWORD

转载于:https://blog.51cto.com/13749470/2385769

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/275248.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Oracle中的wmsys.wm_concat

Oracle中的wmsys.wm_concat主要实现行转列功能(说白了就是将查询的某一列值使用逗号进行隔开拼接,成为一条数据)。 wmsys.wm_concat除了单独使用外还可以和over函数结合使用。 开始看看具体使用方法: select t.rank, t.Name from t_menu_item t; rank…

Github 王炸功能!Copilot 替代打工人编程?

大家好,我是若川。最近组织了源码共读活动,感兴趣的可以加我微信 ruochuan12 参与,已进行三个月了,大家一起交流学习,共同进步。大家好,我是皮汤。最近组里在讨论一个有意思的工具 Github Copilot&#xff…

ux和ui_糟糕的UI与UX番茄酱模因

ux和uiAt face value, this meme appears to be a quick and easy tool for educating the general public about what the differences are between UI and UX. You might look at the attractive glass bottle labeled “UI” and understand that UI might have to do more …

Linux中的wheel用户组是什么?

在Linux中wheel组就类似于一个管理员的组。 通常在Linux下,即使我们有系统管理员root的权限,也不推荐用root用户登录。一般情况下用普通用户登录就可以了,在需要root权限执行一些操作时,再su登录成为root用户。但是,任…

ElementUI 组件库 md-loader 的解析和优化

大家好,我是若川。最近组织了源码共读活动,感兴趣的可以加我微信 ruochuan12 参与,已进行三个月了,大家一起交流学习,共同进步。背景相信很多同学在学习 webpack 的时候,对 loader 的概念应该有所了解&…

一个html5流星雨源码

流星会随着鼠标的方向划过&#xff0c;按紧鼠标左键可以增长流星的尾巴。 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang"zh-CN"> <head> <title>流星雨<…

csdn 用户 蚂蚁翘大象_用户界面设计师房间里的大象

csdn 用户 蚂蚁翘大象Once upon a time, an educated eye detected a new trend in UI designs, particularly, in Dribbble. It was a conceptual proposition, not an actual design for a customer or an app. Trying to explain the characteristics of this new trend, a …

面试官问发布订阅模式是在问什么?

大家好&#xff0c;我是若川。最近组织了源码共读活动&#xff0c;感兴趣的可以加我微信 ruochuan12 参与&#xff0c;已进行了三个多月&#xff0c;大家一起交流学习&#xff0c;共同进步。本文来自 simonezhou 小姐姐投稿的第八期笔记。面试官常问发布订阅、观察者模式&#…

linux服务器内存、根目录使用率、某进程的监控告警脚本

脚本内容如下 #!/bin/bash#磁盘超过百分之80发送邮件告警DISK_USEDdf -T |sed -n "2p" |awk {print ($4/$3)*100}DISK_percentage80if [ expr "$DISK_USED > $DISK_percentage" ]thenecho "$HOSTNAME服务器当前硬盘使用率为$DISK_USED%" | ma…

figma下载_不用担心Figma中的间距

figma下载重点 (Top highlight)I spend way too much time caring about spacing when designing interfaces and building design systems. You are probably no stranger to the constant 1 px and 8 px nudging, continuous checking of the bottom or in-between space for…

【建议收藏】面试官贼喜欢问的 32+ vue 修饰符,你掌握几种啦?

大家好&#xff0c;我是若川。最近组织了源码共读活动&#xff0c;感兴趣的可以加我微信 ruochuan12 参与&#xff0c;已进行了三个多月&#xff0c;大家一起交流学习&#xff0c;共同进步。前言vue简洁好用体现在很多个地方&#xff0c;比如其内置了32修饰符&#xff0c;可以很…

知识管理系统Data Solution研发日记之一 场景设计与需求列出

在平时开发的过程中&#xff0c;经常会查找一些资料&#xff0c;从网上下载一些网页&#xff0c;压缩格式文件到自己的电脑中&#xff0c;然后阅读。程序有别于其他行业的一个特征是&#xff0c;所有的资料&#xff0c;数据&#xff0c;压缩文件&#xff0c;只用于产生可以工作…

系列TCP/IP协议-动态IP选路协议(008)

一、引言 前一章已经说过了IP数据包是如何分发的。为啥这一章还要说这个问题&#xff1f;在网络很小、只有单个连接点、没有多余的路由的时候&#xff0c;使用静态选路是可以的。但是一旦网络变大一点就会出现各种问题。在大网络中的网络选路将在该节说明。   动态选路协议用…

shields 徽标_我们如何准确地记住著名徽标的特征和颜色?

shields 徽标The logos of global corporations like Apple, Starbucks, Adidas, and IKEA are designed to create instant brand associations in the minds of billions who see them every day. But how accurately can we remember the features and colors of these famo…

面了三次字节,他的一些感悟

大家好&#xff0c;我是若川。最近组织了源码共读活动&#xff0c;感兴趣的可以加我微信 ruochuan12 参与&#xff0c;已进行了三个多月&#xff0c;大家一起交流学习&#xff0c;共同进步。今天分享一篇小K投稿的字节面试记录&#xff0c;这是他第三次面字节了&#xff0c;之前…

JavaScript数组内置排序函数

javascript内置的sort函数是多种排序算法的集合 JavaScript实现多维数组、对象数组排序&#xff0c;其实用的就是原生的sort()方法&#xff0c;用于对数组的元素进行排序。 sort() 方法用于对数组的元素进行排序。语法如下&#xff1a; ArrayObject.sort(order); 测试A&#xf…

解决Wireshark安装Npcap组件失败

2019独角兽企业重金招聘Python工程师标准>>> 解决Wireshark安装Npcap组件失败 从Wireshark 3.0开始&#xff0c;Npcap取代Winpcap组件&#xff0c;成为Wireshark默认的网卡核心驱动。由于该组件属于驱动程序&#xff0c;所以安装时候容易被杀毒/防火墙软件拦截&…

adobe清理工具_Adobe终于通过其新的渐变工具实现了这一点-UX评论

adobe清理工具的Photoshop (Photoshop) UX:用户体验&#xff1a; At first glance, the UX looks okay; it’s pretty clear. The user gets to know how to use this tool right away. The color palette is located above, and the gradient down below. The diamond betwee…

GMF学习系列(二) 一些知识点(续2)

8.插件的国际化&#xff0c;可以参考nwpu.cdcsp.sbpel.diagram.part中messages.java的做法。 9.Text自动提示功能 import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.fieldassist.AutoCompleteField; im…

新手向:前端程序员必学基本技能——调试JS代码

1前言大家好&#xff0c;我是若川。最近组织了源码共读活动&#xff0c;感兴趣的可以加我微信 ruochuan12 参与&#xff0c;已进行三个月了&#xff0c;大家一起交流学习&#xff0c;共同进步。想学源码&#xff0c;极力推荐之前我写的《学习源码整体架构系列》 包含jQuery、un…