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

二进制/源码编译安装mysql 8.0

二进制方式:

1.下载或上传安装包至设备:

2.创建组与用户:

[root@openEuler-1 ~]# groupadd mysql
[root@openEuler-1 ~]# useradd -r -g  mysql -s /bin/false mysql

3.解压安装包:

tar xf mysql-8.0.36-linux-glibc2.12-x86_64.tar.xz -C /usr/local

4.建立软链接:

 ln -sv /usr/local/mysql-8.0.36-linux-glibc2.12-x86_64/ /usr/local/mysql

5.初始化:

[root@openEuler-1 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data
2025-01-15T15:01:42.254967Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.36) initializing of server in progress as process 1935
2025-01-15T15:01:42.260421Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-01-15T15:01:42.971402Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-01-15T15:01:44.318709Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >HYAHNuRd4+f        (初始密码)

6.编辑配置文件:

[root@openEuler-1 ~]# vim /etc/my.cnf
 

basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/
socket=/tmp/mysql.sock
log-error=/usr/local/mysql/data/mysqld.log
pid-file=/usr/local/mysql/data/mysqld.pid

7.给予软件目录权限:

[root@openEuler-1 ~]# chown -R mysql.mysql /usr/local/mysql/*

8.拷贝服务脚本:

[root@openEuler-1 ~]# cd /usr/local/mysql/
[root@openEuler-1 mysql]# ls
bin  data  docs  include  lib  LICENSE  man  README  share  support-files
[root@openEuler-1 mysql]# cd support-files/
[root@openEuler-1 support-files]# ls
mysqld_multi.server  mysql-log-rotate  mysql.server
[root@openEuler-1 support-files]# cp mysql.server /etc/init.d/mysqld

9.将服务脚本添加为系统服务:

[root@openEuler-1 support-files]# chkconfig --add mysqld
[root@openEuler-1 support-files]# ll /etc/rc.d/rc3.d/
total 0
lrwxrwxrwx 1 root root 16 Jan 15 23:30 S64mysqld -> ../init.d/mysqld

10.将服务脚本设置为开机自启动:

[root@openEuler-1 support-files]# chkconfig mysqld on
[root@openEuler-1 support-files]# chkconfig --list mysqld

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

11.启动服务:

[root@openEuler-1 ~]# systemctl start mysql
[root@openEuler-1 ~]# systemctl status mysql
● mysqld.service - LSB: start and stop MySQL
     Loaded: loaded (/etc/rc.d/init.d/mysqld; generated)
     Active: active (running) since Wed 2025-01-15 23:49:43 CST; 32s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 2450 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=>
      Tasks: 39 (limit: 8932)
     Memory: 462.6M
     CGroup: /system.slice/mysqld.service
             ├─ 2463 /bin/sh /usr/local/mysql//bin/mysqld_safe --datadir=/usr/l>
             └─ 2621 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql/ -->

Jan 15 23:49:41 openEuler-1 systemd[1]: Starting LSB: start and stop MySQL...
Jan 15 23:49:41 openEuler-1 mysqld[2450]: Starting MySQL.
Jan 15 23:49:41 openEuler-1 mysqld[2463]: Logging to '/usr/local/mysql/data/mys>
Jan 15 23:49:43 openEuler-1 mysqld[2450]: . SUCCESS!
Jan 15 23:49:43 openEuler-1 systemd[1]: Started LSB: start and stop MySQL.

12.安装依赖:

[root@openEuler-1 ~]# yum install ncurses-compat-libs

13.使用绝对路径登录,并修改密码:

[root@openEuler-1 ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password: (>HYAHNuRd4+f)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.36

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  show databases
    -> ;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER root@localhost  identified by '123';
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql>  show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
 

14.配置环境变量:

[root@openEuler-1 ~]# vim /etc/profile.d/mysql.sh

#!/bin/bash
export PATH=$PATH:/usr/local/mysql/bin/

[root@openEuler-1 ~]# source /etc/profile.d/mysql.sh  #使立即生效,加载到 当前
 

验证:

[root@openEuler-1 ~]# mysql -uroot -p123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
 

源码编译方式:

 服务配置方法2:
注意:两种不要同时配置

服务配置
vi /usr/lib/systemd/system/mysqld.service

##加入以下内容即可
[Unit]
Description=Mysql server
After=network.target
 
[Install]
WantedBy=multi-user.target
 
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --daemonize $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID  
ExecStop=/bin/kill -s QUIT $MAINPID 
 
KillMode=process
LimitNOFILE=65535
Restart=on-failure
RestartSec=10
RestartPreventExitStatus=1
PrivateTmp=false

加载设置
  systemctl daemon-reload
启动服务
 

相关文章:

二进制/源码编译安装mysql 8.0

二进制方式: 1.下载或上传安装包至设备: 2.创建组与用户: [rootopenEuler-1 ~]# groupadd mysql [rootopenEuler-1 ~]# useradd -r -g mysql -s /bin/false mysql 3.解压安装包: tar xf mysql-8.0.36-linux-glibc2.12-x86_64.ta…...

2025-1-15-十大经典排序算法 C++与python

文章目录 十大经典排序算法比较排序1. 冒泡排序2. 选择排序3. 插入排序4. 希尔排序5. 归并排序6. 快速排序7. 堆排序 非比较排序8. 计数排序9. 桶排序10. 基数排序 十大经典排序算法 十大经典排序算法可以分为比较排序和非比较排序: 前者包括冒泡排序、选择排序、插入排序、希…...

头盔识别技术

本项目参考b站视频https://www.bilibili.com/video/BV1EhkiY2Epg/?spm_id_from333.999.0.0&vd_source6c722ac1eba24d4cbadc587e4d1892a7 1.下载miniconda 使用 Miniconda 来管理 Python 环境(如 yolov8),就可以通过 conda create -n y…...

DeepSeek-v3在训练和推理方面的优化

1. 基础架构:MLA,大幅减少了KV cache大小。(计算量能不能减少?) 2. 基础架构:MoE,同等参数量(模型的”能力“)下,训练、推理的计算量大幅减少。 3. MoE的load…...

将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(3 纯python的经济方案)

前情: 将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(1)-CSDN博客 将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(2)-CSDN博客 python脚本实现 厉害的小伙伴最终使用python脚本免费…...

1️⃣Java中的集合体系学习汇总(List/Map/Set 详解)

目录 01. Java中的集合体系 02. 单列集合体系​ 1. Collection系列集合的遍历方式 (1)迭代器遍历(2)增强for遍历​编辑(3)Lambda表达式遍历 03.List集合详解 04.Set集合详解 05.总结 Collection系列…...

闪豆多平台视频批量下载器

1. 视频链接获取与解析 首先,在哔哩哔哩网页中随意点击一个视频,比如你最近迷上了一个UP主的美食制作视频,想要下载下来慢慢学。点击视频后,复制视频页面的链接。复制完成后,不要急着关闭浏览器,因为接下来…...

深入解析:如何用Java爬取淘宝分类详情接口(cat_get)

一、前言 淘宝分类详情接口(cat_get)是淘宝开放平台提供的一个接口,允许开发者获取淘宝商品的分类详情,包括分类ID、分类名称、父分类等信息。这些数据对于电商分析、市场研究和商品分类管理等具有重要价值。本文将详细介绍如何使…...

语音识别的预训练模型

语音识别的预训练模型 语音识别模型 大致分为两类: 连接时序分类(Connectionist Temporal Classification, CTC):仅编码器(encoder-only)的模型,顶部带有线性分类(CTC)头序列到序列(Sequence-to-sequence, Seq2Seq):编码器-解码器(encoder-decoder)模型,编码器…...

element-ui制作多颜色选择器

将颜色存储到一个数组中去。 <template><div class"color-picker-container" style"margin-top: 10px;"><!-- 显示已选颜色 --><div class"color-selection"><divv-for"(color, index) in selectedColors"…...

JVM体系结构

目录 一. JVM 规范 二. JVM 实现 (1) HotSpot (2) JRockit (3) IBM JDK&#xff08;J9 VM&#xff09; (4) Azul Zing (5) OpenJ9 三. JVM 实现的选择 四. JVM 的核心组件 五.JVM总结 六.Java 虚拟机&#xff08;JVM&#xff09;架构概述 1.Java 虚拟机&#xff08…...

wandb使用遇到的一些问题

整合了一下使用wandb遇到的问题 1.请问下如果电脑挂了代理&#xff0c;应该怎么办呢&#xff1f;提示&#xff1a;Network error (ProxyError), entering retry loop. 在本地&#xff08;而非服务器&#xff09;运行代码时&#xff0c;常常因为开启代理而无法使用wandb&#…...

Java中的继承

引入继承 Java中使用类对实体进行描述&#xff0c;类经过实例化之后的产物对象&#xff0c;就可以用来表示现实中的实体&#xff0c;描述的事物错综复杂&#xff0c;事物之间可能会存在一些关联&#xff0c;因此我们就需要将他们共性抽取&#xff0c;面向对象的思想中提出了继…...

Cadence笔记--原理图导入PCB

1、以PMU6050为例&#xff0c;首先在原理图双击PMU6050器件&#xff0c;在PCB_Footprint目录填写PCB封装名称并且保存&#xff0c;如下图所示&#xff1a; 2、确保原理图命名的名称不一样&#xff0c;否则会出错&#xff0c;这里PMU6050更改了NC等名称&#xff0c;如下图所示&a…...

从AI生成内容到虚拟现实:娱乐体验的新边界

引言 在快速发展的科技时代&#xff0c;娱乐行业正经历一场前所未有的变革。传统的娱乐方式正与先进技术融合&#xff0c;创造出全新的沉浸式体验。从AI生成的个性化内容&#xff0c;到虚拟现实带来的身临其境的互动场景&#xff0c;科技不仅改变了我们消费娱乐的方式&#xf…...

【Linux】gdb_进程概念

&#x1f4e2;博客主页&#xff1a;https://blog.csdn.net/2301_779549673 &#x1f4e2;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1f4dd; 如有错误敬请指正&#xff01; &#x1f4e2;本文由 JohnKi 原创&#xff0c;首发于 CSDN&#x1f649; &#x1f4e2;未来很长&#…...

安全类脚本:拒绝ssh暴力破解

要求如下&#xff1a; 一个小时内&#xff0c;连续密码错误4次。 Linux lastb 命令用于列出登入系统失败的用户相关信息。 实验过程如下&#xff1a; 1. 创建两个IP地址不同的干净环境&#xff0c;分别是&#xff1a;192.168.46.101 Rocky 2 和 192.168.46.120 openEuler 2. 2.…...

Android15源码编译问题处理

最近想在Raspberry Pi5上面运行自己编译的Android15镜像,参考如下链接来处理: GitHub - raspberry-vanilla/android_local_manifest GitHub - raspberry-vanilla/android_kernel_manifest 代码同步完后,编译就出问题了,总是提示: FAILED: analyzing Android.bp files and…...

图解Git——分布式Git《Pro Git》

分布式工作流程 Centralized Workflow&#xff08;集中式工作流&#xff09; 所有开发者都与同一个中央仓库同步代码&#xff0c;每个人通过拉取、提交来合作。如果两个开发者同时修改了相同的文件&#xff0c;后一个开发者必须在推送之前合并其他人的更改。 Integration-Mana…...

Linux内核编程(二十一)USB应用及驱动开发

一、基础知识 1. USB接口是什么&#xff1f; USB接口&#xff08;Universal Serial Bus&#xff09;是一种通用串行总线&#xff0c;广泛使用的接口标准&#xff0c;主要用于连接计算机与外围设备&#xff08;如键盘、鼠标、打印机、存储设备等&#xff09;之间的数据传输和电…...

手把手教你用Ollama玩转translategemma-27b-it:图文翻译全攻略

手把手教你用Ollama玩转translategemma-27b-it&#xff1a;图文翻译全攻略 1. 认识translategemma-27b-it&#xff1a;你的专业翻译助手 1.1 什么是translategemma-27b-it translategemma-27b-it是Google基于Gemma 3架构开发的开源翻译模型&#xff0c;专为多语言图文翻译任…...

告别pip install langchain!用uv一步搞定LangChain 1.x环境(附pyproject.toml配置)

用uv重构LangChain开发环境&#xff1a;从依赖管理到生产级配置实战 如果你还在用pip install langchain搭建开发环境&#xff0c;可能已经落后于现代Python开发的效率标准了。当项目依赖逐渐复杂&#xff0c;特别是需要处理像LangChain这样包含多个可选组件&#xff08;如open…...

三步解决Windows系统Cursor试用限制:go-cursor-help技术工具重置方案

三步解决Windows系统Cursor试用限制&#xff1a;go-cursor-help技术工具重置方案 【免费下载链接】go-cursor-help 解决Cursor在免费订阅期间出现以下提示的问题: Youve reached your trial request limit. / Too many free trial accounts used on this machine. Please upgra…...

智慧医院的“新基建”:从顶层设计到全栈式智能运维的深度解构(PPT)

“未来的医院&#xff0c;其核心竞争力将不再仅仅是顶尖的医生和昂贵的设备&#xff0c;而是由数据驱动、以患者为中心、能自我优化的智慧生命体。”在“健康中国2030”与“数字中国”两大国家战略交汇的时代背景下&#xff0c;医疗健康产业正经历一场前所未有的数字化重构。传…...

OpenClaw技能市场盘点:10个适配Qwen3.5-4B-Claude的实用模块

OpenClaw技能市场盘点&#xff1a;10个适配Qwen3.5-4B-Claude的实用模块 1. 为什么需要关注技能市场&#xff1f; 去年冬天&#xff0c;当我第一次在本地部署OpenClaw时&#xff0c;最让我惊喜的不是框架本身&#xff0c;而是它背后那个不断生长的技能市场。作为一个长期被重…...

一文搞懂:Agent、Harness Engineering、MCP、Skill 到底是什么

&#x1f9ed; 你是否被这些词搞晕过&#xff1f; Agent Harness Engineering MCP Skill Tool Workflow…… 大模型时代&#xff0c;新概念层出不穷。它们分别是什么&#xff1f;又如何协同工作&#xff1f; 这篇文章是你的概念地图。 大模型生态&#xff1a;四个核心概…...

如何用浏览器扩展将网页内容一键转换为AI知识库

如何用浏览器扩展将网页内容一键转换为AI知识库 【免费下载链接】anything-llm 这是一个全栈应用程序&#xff0c;可以将任何文档、资源&#xff08;如网址链接、音频、视频&#xff09;或内容片段转换为上下文&#xff0c;以便任何大语言模型&#xff08;LLM&#xff09;在聊天…...

5个步骤快速搭建医院信息系统:终极医疗数字化解决方案

5个步骤快速搭建医院信息系统&#xff1a;终极医疗数字化解决方案 【免费下载链接】HIS ZainZhao/HIS: HIS 通常代表医疗信息系统&#xff08;Hospital Information System&#xff09;&#xff0c;但此链接指向的具体项目信息未知&#xff0c;可能是某个开发者设计或维护的医院…...

795. 广告标识工厂哪家上门维修最及时?

在当今商业社会&#xff0c;广告标识对于企业的品牌展示和宣传起着至关重要的作用。然而&#xff0c;广告标识在使用过程中难免会出现各种问题&#xff0c;这就需要及时的上门维修服务。那么&#xff0c;广告标识工厂哪家上门维修最及时呢&#xff1f;今天就为大家推荐河北兴盛…...

铜钟音乐:告别广告与社交干扰的纯净听歌工具

铜钟音乐&#xff1a;告别广告与社交干扰的纯净听歌工具 【免费下载链接】tonzhon-music 铜钟 (Tonzhon.com): 免费听歌; 没有直播, 社交, 广告, 干扰; 简洁纯粹, 资源丰富, 体验独特&#xff01;(密码重置功能已回归) 项目地址: https://gitcode.com/GitHub_Trending/to/ton…...