MySQL

二进制方式:

下载并上传安装包到设备

创建组与用户

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

解压安装包:

[root@localhost ~]# tar xf  mysql-8.0.36-linux-glibc2.28-x86_64.tar.xz -C /usr/local/

软连接


[root@localhost ~]# ln -sv mysql-8.0.36-linux-glibc2.28-x86_64 /usr/local/mysql
'/usr/local/mysql' -> 'mysql-8.0.36-linux-glibc2.28-x86_64'

初始化

[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data
2025-02-04T08:37:33.610736Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.36) initializing of server in progress as process 2086
2025-02-04T08:37:33.625049Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-02-04T08:37:34.296122Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-02-04T08:37:35.362477Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: wYiSf83tCu*2

配置文件

[root@localhost ~]# mkdir /var/log/mysql
[root@openEuler-1 ~]# vim /etc/my.cnfbasedir=/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

增加权限

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

添加系统服务

[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# ls
bin  data  docs  include  lib  LICENSE  man  README  share  support-files
[root@localhost mysql]# cd support-files/
[root@localhost support-files]# ls
mysqld_multi.server  mysql-log-rotate  mysql.server
[root@localhost support-files]# vim mysql.server
[root@localhost support-files]# cp mysql.server /etc/init.d/mysqld
[root@localhost support-files]# ll /etc/rc.d/rc3.d/
total 0
[root@localhost support-files]# chkconfig --add mysqld
[root@localhost support-files]# ll /etc/rc.d/rc3.d/
total 0
lrwxrwxrwx 1 root root 16 Feb  4 16:57 S64mysqld -> ../init.d/mysqld
[root@localhost support-files]# chkconfig mysqld on
[root@localhost support-files]# chkconfig --list mysqldNote: This output shows SysV services only and does not include nativesystemd services. SysV configuration data might be overridden by nativesystemd 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

启动服务

[root@localhost support-files]# systemctl start mysqld

登录MySQL

[root@localhost support-files]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.36Copyright (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>

修改密码

mysql> alter user root@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)

配置环境变量 

[root@localhost support-files]# vim /etc/profile.d/mysql.shexport PATH=$PATH:/usr/local/mysql/bin[root@localhost support-files]# source /etc/profile.d/mysql.sh
[root@localhost support-files]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.36 MySQL Community Server - GPLCopyright (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> 

删除系统服务

[root@localhost support-files]# chkconfig mysqld off
[root@localhost support-files]# chkconfig --list mysqldNote: This output shows SysV services only and does not include nativesystemd services. SysV configuration data might be overridden by nativesystemd 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:off   3:off   4:off   5:off   6:off

删除文件

[root@localhost support-files]# chkconfig --del mysqld
[root@localhost support-files]# ll /etc/init.d/
total 36
-rw-r--r--. 1 root root 18229 Aug 24  2022 functions
-rwxr-xr-x  1 root root 10576 Feb  4 16:55 mysqld
-rw-r--r--. 1 root root  1161 Jun 22  2024 README
[root@localhost support-files]# rm -f /etc/init.d/mysqld

第二种方法

配置文件

[root@localhost support-files]# vim /usr/lib/systemd/system/mysqld.service
Description=MySQL 8.0 database server
After=syslog.target
After=network.target[Service]
Type=notify
User=mysql
Group=mysqlExecStart=/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
ExecStop=/usr/local/mysql/bin/mysqladmin -uroot shutdownTimeoutSec=300
PrivateTmp=trueRestart=on-failureRestartPreventExitStatus=1
LimitNOFILE = 10000[Install]
WantedBy=muli-user.target

 加载设置

[root@localhost support-files]# systemctl daemon-reload

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

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

相关文章

Windows电脑本地部署运行DeepSeek R1大模型(基于Ollama和Chatbox)

文章目录 一、环境准备二、安装Ollama2.1 访问Ollama官方网站2.2 下载适用于Windows的安装包2.3 安装Ollama安装包2.4 指定Ollama安装目录2.5 指定Ollama的大模型的存储目录 三、选择DeepSeek R1模型四、下载并运行DeepSeek R1模型五、常见问题解答六、使用Chatbox进行交互6.1 …

洛谷网站: P3029 [USACO11NOV] Cow Lineup S 题解

题目传送门: P3029 [USACO11NOV] Cow Lineup S - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 前言: 这道题的核心问题是在一条直线上分布着不同品种的牛,要找出一个连续区间,使得这个区间内包含所有不同品种的牛,…

如何利用maven更优雅的打包

最近在客户现场部署项目,有两套环境,无法连接互联网,两套环境之间也是完全隔离,于是问题就来了,每次都要远程到公司电脑改完代码,打包,通过网盘(如果没有会员,上传下载慢…

360手机刷机 360手机解Bootloader 360手机ROOT

360手机刷机 360手机解Bootloader 360手机ROOT 问:360手机已停产,现在和以后,能刷机吗? 答:360手机,是肯定能刷机的 360手机资源下载网站 360手机-360手机刷机RootTwrp 360os.top 360rom.github.io 一、…

8.攻防世界Web_php_wrong_nginx_config

进入题目页面如下 尝试弱口令密码登录 一直显示网站建设中,尝试无果,查看源码也没有什么特别漏洞存在 用Kali中的dirsearch扫描根目录试试 命令: dirsearch -u http://61.147.171.105:53736/ -e* 登录文件便是刚才登录的界面打开robots.txt…

排序算法--计数排序

唯一种没有比较的排序(指没有前后比较,还是有交换的)。统计每个元素出现的次数,直接计算元素在有序序列中的位置,要求数据是整数且范围有限。适用于数据为小范围整数(如年龄、成绩),数据重复率较高时效率更优。可用于小…

PyTorch快速入门

Anaconda Anaconda 是一款面向科学计算的开源 Python 发行版本,它集成了众多科学计算所需的库、工具和环境管理系统,旨在简化包管理和部署,提升开发与研究效率。 核心组件: Conda:这是 Anaconda 自带的包和环境管理…

树莓派卷积神经网络实战车牌检测与识别

文章目录 树莓派介绍1. 树莓派的硬件规格2. 树莓派的操作系统3. 树莓派的应用场景 研究背景一、效果演示1.0 项目获取1.1 图像识别1.2 视频识别 二、技术原理2.1 整体流程2.2 CCPD数据集介绍2.3 车牌定位2.4 车牌矫正2.5 车牌识别2.5.1 CRNN概述2.5.2 CRNN网络架构实现2.5.3 CN…

Redis入门概述

1.1、Redis是什么 Redis:官网 高性能带有数据结构的Key-Value内存数据库 Remote Dictionary Server(远程字典服务器)是完全开源的,使用ANSIC语言编写遵守BSD协议,例如String、Hash、List、Set、SortedSet等等。数据…

如何在自己电脑上私有化部署deep seek

要在自己的电脑上私有化部署 DeepSeek,通常需要以下步骤: 1. 环境准备 操作系统:确保你的电脑操作系统支持 Docker 或直接安装 Python 环境(如 Linux、Windows 或 macOS)。 Python 环境:安装 Python 3.7 …

【办公类-99-01】20250201学具PDF打印会缩小一圈——解决办法:换一个PDF阅读器

背景需求: 2024年1月13日,快要放寒假了,组长拿着我们班的打印好的一叠教案来调整。 “前面周计划下面的家园共育有调整,你自己看批注。” “还有你这个教案部分的模版有问题,太小(窄)了。考虑…

k8s集群

文章目录 项目描述项目环境系统与软件版本概览项目步骤 环境准备IP地址规划关闭selinux和firewall配置静态ip地址修改主机名添加hosts解析 项目步骤一、使用kubeadm安装k8s单master的集群环境(1个master2个node节点)1、互相之间建立免密通道2.关闭交换分…

HTTP和HTTPS协议详解

HTTP和HTTPS协议详解 HTTP详解什么是http协议http协议的发展史http0.9http1.0http1.1http2.0 http协议的格式URI和URL请求request响应response http协议完整的请求与响应流程 HTTPS详解为什么使用HTTPSSSL协议HTTPS通信过程TLS协议 HTTP详解 什么是http协议 1、全称Hyper Tex…

2025开源DouyinLiveRecorder全平台直播间录制工具整合包,多直播同时录制、教学直播录制、教学视频推送、简单易用不占内存

一、DouyinLiveRecorder软件介绍(文末提供下载) 官方地址:GitHub - ihmily/DouyinLiveRecorder 本文信息来源于作者GitHub地址 一款简易的可循环值守的直播录制工具,基于FFmpeg实现多平台直播源录制,支持自定义配置录制…

学习threejs,pvr格式图片文件贴图

👨‍⚕️ 主页: gis分享者 👨‍⚕️ 感谢各位大佬 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍⚕️ 收录于专栏:threejs gis工程师 文章目录 一、🍀前言1.1 ☘️PVR贴图1.2 ☘️THREE.Mesh…

Beans模块之工厂模块注解模块CustomAutowireConfigurer

博主介绍:✌全网粉丝5W,全栈开发工程师,从事多年软件开发,在大厂呆过。持有软件中级、六级等证书。可提供微服务项目搭建与毕业项目实战,博主也曾写过优秀论文,查重率极低,在这方面有丰富的经验…

(一)DeepSeek大模型安装部署-Ollama安装

大模型deepseek安装部署 (一)、安装ollama curl -fsSL https://ollama.com/install.sh | sh sudo systemctl start ollama sudo systemctl enable ollama sudo systemctl status ollama(二)、安装ollama遇到网络问题,请手动下载 ollama-linux-amd64.tgz curl -L …

使用Pygame制作“贪吃蛇”游戏

贪吃蛇 是一款经典的休闲小游戏:玩家通过操控一条会不断变长的“蛇”在屏幕中移动,去吃随机出现的食物,同时要避免撞到墙壁或自己身体的其他部分。由于其逻辑相对简单,但可玩性和扩展性都不错,非常适合作为新手练习游戏…

【prompt实战】AI +OCR技术结合ChatGPT能力项目实践(BOL提单识别提取专家)

本文原创作者:姚瑞南 AI-agent 大模型运营专家,先后任职于美团、猎聘等中大厂AI训练专家和智能运营专家岗;多年人工智能行业智能产品运营及大模型落地经验,拥有AI外呼方向国家专利与PMP项目管理证书。(转载需经授权) 目录 1. 需求背景 2. 目标 3. BOL通用处理逻辑…

dl学习笔记(8):fashion-mnist

过完年懒羊羊也要复工了,这一节的内容不多,我们接着上次的fashion-mnist数据集。 首先第一步就是导入数据集,由于这个数据集很有名,是深度学习的常见入门数据集,所以可以在库里面导入。由于是图像数据集所以&#xff…