当前位置: 首页 > news >正文

centos7 xtrabackup mysql 基本测试(3)---虚拟机环境 安装mysql

centos7 xtrabackup mysql 基本测试(3)—虚拟机环境 安装mysql

centos7 安装 mysql5.7

可以在运行安装程序之前导入密钥:

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

第一步、下载MySQL 安装包:

sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

第二步 安装mysql 安装源:

sudo yum -y localinstall mysql57-community-release-el7-11.noarch.rpm

第三步,在线安装MySQL

sudo yum -y install mysql-community-server

第四步、启动mysql 服务

sudo systemctl start mysqld

第五步,设置开机启动

sudo systemctl enable mysqld
sudo systemctl daemon-reload

查看mysql 版本

mysql --version

查看密码:

sudo cat /var/log/mysqld.log|grep 'A temporary password'

内容为

2024-06-12T07:32:58.419207Z 1 [Note] A temporary password is generated for root@localhost: UHpsYQw?u20X

修改密码

mysql -u root -p
alter user 'root'@'localhost' identified by '1234aA~1';

增加一个 etc 用户

1.创建一个名为user1,密码为password1的用户,允许从任何主机连接:

CREATE USER 'etc'@'%' IDENTIFIED by '1234aA~1';
GRANT ALL ON *.* TO 'etc'@'%';
flush privileges;

查看用户权限

show grants for 'etc'@'%';

内容

+------------------------------------------+
| Grants for etc@%                         |
+------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'etc'@'%' |
+------------------------------------------+
1 row in set (0.00 sec)

mysql 原始 配置文件

cat /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

下一步就是 修改datadir

防火墙
#查看防火墙状态
sudo firewall-cmd --state
#开放端口
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
#重新载入:
sudo firewall-cmd --reload
#查看所有打开的端口
sudo firewall-cmd --zone=public --list-ports

http://www.lryc.cn/news/373124.html

相关文章:

  • Java Native Interface 使用指南
  • 代码随想录算法训练营第三十九天 | 62.不同路径、63. 不同路径 II、343. 整数拆分、96.不同的二叉搜索树
  • C/C++函数指针、C#委托是什么?
  • 红队攻防渗透技术实战流程:组件安全:JacksonFastJsonXStream
  • Perl 语言学习进阶
  • LangGraph实战:从零分阶打造人工智能航空客服助手
  • R可视化:R语言基础图形合集
  • mysql导入sql文件失败及解决措施
  • JS:获取鼠标点击位置
  • 使用开源的zip.cpp和unzip.cpp实现压缩包的创建与解压(附源码)
  • npm 异常:peer eslint@“>=1.6.0 <7.0.0“ from eslint-loader@2.2.1
  • Docker|了解容器镜像层(2)
  • 使用Python爬取temu商品与评论信息
  • mybatis学习--自定义映射resultMap
  • Elasticsearch之写入原理以及调优
  • python中装饰器的用法
  • php实现一个简单的MySQL分页
  • 算法训练营day23补签
  • 国密SM2JS加密后端解密
  • Cheat Engine.exe修改植物大战僵尸阳光与冷却
  • python内置模块之queue(队列)用法
  • Spring Security——结合JWT实现令牌的验证与授权
  • Vector的底层结构剖析
  • 实现抖音视频滑动功能vue3+swiper
  • Linux文件系统【真的很详细】
  • JAVA学习笔记DAY5——Spring_Ioc
  • WPF中的隧道路由和冒泡路由事件
  • ISO七层模型 tcp/ip
  • MySQL的三种重要的日志
  • 神经网络学习2