惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
J
Java Code Geeks
Martin Fowler
Martin Fowler
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
博客园 - 【当耐特】
Y
Y Combinator Blog
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
G
Google Developers Blog
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
大猫的无限游戏
大猫的无限游戏
罗磊的独立博客
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 司徒正美

博客园 - vsignsoft

Apache Doris 编译 Tensorflow 模型保存与调用 制作 macOS Mojave 映像文件 编程实现文件重定向 openssh 免用户名/密码/服务器地址,登录远程服务器 FreeSWITCH 增加模块 mod_ilbc 解析 iOS crash 文件 私有地址与公网地址的转换 Supervisor 自动管理进程 使用 uWSGI 部署 Flask web 应用 安装 Flask macOS 上创建 Windows 兼容的 iso镜像文件 公式 X/N = int(H/N) * 65536 + [rem(H/N) * 65536 + L]/N 的运用 在VirtualBox 里安装纯DOS,进行汇编编程实践 Xcode 6、7 打包 苹果笔记本电脑,开不了机经验记录 CST时间转换成 yyyy-MM-dd格式 git 常规使用小结 XCode6 开发本地化应用
CentOS7 安装 mysql-8.0.25-el7-x86_64.tar.gz
vsignsoft · 2021-05-18 · via 博客园 - vsignsoft

下载好安装包:mysql-8.0.25-el7-x86_64.tar.gz

假设解压后的目录为: /opt/mysql/mysql-8.0.25-el7-x86_64

1、修改脚本

进入该目录下的脚本文件: support-files/mysql.server

根据脚本内容,假设设置变量为:

basedir=/opt/mysql/mysql-8.0.25-el7-x86_64
datadir=/opt/mysql/data

basedir 表示mysql安装包家目录;

datadir 表示存放数据文件的目录;

2、编辑配置文件 /etc/my.cnf 

[mysqld]
datadir=/opt/mysql/data
# socket=/opt/mysql/mysql-8.0.25-el7-x86_64/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd 

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

# include all files from the config directory
!includedir /etc/my.cnf.d

确保 datadir 跟步骤1 一致;

3. 创建mysql  组及用户

groupadd mysql
useradd -r -g mysql -s /bin/false mysql

4. 设置用户 mysql 拥有mysql数据目录及mysql家目录权限

chown -R mysql:mysql /opt/mysql/data
chown -R mysql:mysql /opt/mysql/mysql-8.0.25-el7-x86_64

5. 生成mysql数据文件

在 /opt/mysql/mysql-8.0.25-el7-x86_64 目录里,运行:

./bin/mysqld --user=mysql --base=/opt/mysql/mysql-8.0.25-el7-x86_64 --datadir=/opt/mysql/data --initialize

6、启动mysql服务

在 /opt/mysql/mysql-8.0.25-el7-x86_64 目录里,运行:

./support-files/mysql.server start