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.serviceDescription=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/24799.html

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

相关文章

jdk21下载、安装(Windows、Linux、macOS)

Windows 系统 1. 下载安装 访问 Oracle 官方 JDK 下载页面 或 OpenJDK 下载页面,根据自己的系统选择合适的 Windows 版本进行下载(通常选择 .msi 安装包)。 2. 配置环境变量 右键点击 “此电脑”,选择 “属性”。 在左侧导航栏…

docker的下载与使用(一)

本文默认使用linux系统以及会linux的基本指令,windows下安装docker较为繁琐 docker是什么 Docker 是一个开源的应用容器引擎,基于go 语言并遵从 Apache2.0 协议开源。 Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中&…

WIn32 笔记:本专栏课件

专栏导航 上一篇:在VS2019里面,调整代码字体大小 回到目录 下一篇:计算机基础:二进制基础01,比特与字节 本节前言 在之前的讲解里面,我讲解了 Visual Studio 软件的一些个基础操作步骤。从本节开始&am…

【NLP 27、文本分类任务 —— 传统机器学习算法】

不要抓着枯叶哭泣,你要等待初春的新芽 —— 25.1.23 一、文本分类任务 定义:预先设定好一个文本类别集合,对于一篇文本,预测其所属的类别 例如: 情感分析: 这家饭店太难吃了 —> 正类 …

基于YOLO11深度学习的医学X光骨折检测与语音提示系统【python源码+Pyqt5界面+数据集+训练代码】

《------往期经典推荐------》 一、AI应用软件开发实战专栏【链接】 项目名称项目名称1.【人脸识别与管理系统开发】2.【车牌识别与自动收费管理系统开发】3.【手势识别系统开发】4.【人脸面部活体检测系统开发】5.【图片风格快速迁移软件开发】6.【人脸表表情识别系统】7.【…

FastAPI系列:Ubuntu部署FastAPI项目实战

这篇文章提供了在Ubuntu上部署FastAPI应用程序的详细指南。首先,读者将学习如何创建项目目录并设置Python虚拟环境,接着安装FastAPI、Uvicorn和Gunicorn等必要依赖。随后,文章指导用户编写基本的FastAPI应用程序代码,并使用Gunico…

Redis缓存淘汰算法——LRU

文章目录 一、LRU 算法概述1.1 LRU 算法的工作原理1.2 手写LRU 二、Redis 中的 LRU 算法2.1 近似 LRU 算法2.2 如何判断“最近最少使用”的键?2.3 Redis 中的 LRU 配置 在 Redis 中, LRU(Latest Recently Used,最近最少使用&…

【原创工具】同文件夹PDF文件合并 By怜渠客

【原创工具】同文件夹PDF文件合并 By怜渠客 原贴:可批量合并多个文件夹内的pdf工具 - 吾爱破解 - 52pojie.cn 他这个存在一些问题,并非是软件内自主实现的PDF合并,而是调用的pdftk这一工具,但楼主并没有提供pdftk,而…

C# Combox 绑定数据

1.在界面中添加一个combox 2.将数据绑定到combox List<GrindingType> type new List<GrindingType>();type.Add(new GrindingType { Id 1, Name "Product A", Type new List<string> { "1", "2" } });type.Add(new Grin…

怎样能写出完美的Prompt

怎样能写出完美的Prompt 大模型发展Prompt 实测最后感受 大模型发展 随着语言大模型的智能化演进&#xff0c;其作为内容生产引擎的核心竞争力日益凸显。如何通过Prompt工程深度释放其潜能&#xff0c;实现工作效率的指数级提升与文本质量的突破性飞跃&#xff0c;本质上是对&…

【含开题报告+文档+PPT+源码】基于SpringBoot+Vue的农村合作社招聘系统

开题报告 本文以服务新农村建设为背景&#xff0c;针对农村劳动力就业信息获取不充分、求职效率低下的问题&#xff0c;设计并实现了农村合作社招聘系统。该平台具备注册登录、个人信息管理、就业资讯发布与互动、岗位搜索、详细信息查看、岗位申请以及申请状态跟踪等功能。系…

数据结构与算法-图论-最短路-拓展运用

选择最佳路线 分析&#xff1a; 这是一道图论中的最短路径问题&#xff0c;目标是在给定的公交网络中&#xff0c;找到从琪琪家附近的车站出发&#xff0c;到她朋友家附近车站&#xff08;编号为 s &#xff09;的最短时间。以下是对该问题的详细分析&#xff1a; 问题关键信息…

鸿道Intewell操作系统的Linux实时拓展方案

在工业控制、智能制造、自动驾驶等领域&#xff0c;实时性一直是操作系统的核心挑战。Linux作为开源系统的代表&#xff0c;虽然具备生态丰富&#xff0c;功能强大的优势&#xff0c;但其内核调度机制与中断处理能力难以满足微秒级硬实时要求。针对这一痛点&#xff0c;鸿道Int…

搭建Nexus前端npm私服,上传发布npm包和下载依赖

1、创建repository 登录Nexus的管理页面&#xff0c;创建npm&#xff08;proxy&#xff09;和npm&#xff08;hosted&#xff09;&#xff0c;然后创建npm&#xff08;group&#xff09;将这两个repository包含进来。 1.1 创建npm&#xff08;proxy&#xff09; 选择npm&…

数组总结【代码随想录】

一.数组 1.lc 27移除数组中的重复元素 且必须仅使用 O(1) 额外空间并 原地 修改输入数组。 输入&#xff1a;nums [3,2,2,3], val 3 输出&#xff1a;2, nums [2,2] 解释&#xff1a;函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。你不需要考虑数组中超出新长…

大模型训练——pycharm连接实验室服务器

一、引言 我们在运行或者复现大佬论文代码的时候&#xff0c;笔记本的算力不够&#xff0c;需要使用实验室的服务器进行运行。可以直接在服务器的终端上执行&#xff0c;但是这样的话代码调试就不方便。而我们可以使用 pycharm 连接到服务器&#xff0c;既方便了代码调试&…

STM32的C语言软件延时函数

STM32的延时方法很多&#xff0c;其中采用定时器延时&#xff0c;可以得到较为精确的延时&#xff0c;但是有时对延时精度要求不高的场合&#xff0c;采用软件延时&#xff0c;也是必须的。特别是在RTOS系统中&#xff0c;使用SysTick的普通计数模式对延迟进行管理&#xff0c;…

前端网页或者pwa如何实现只横屏显示,设备竖着的时候依然保持横屏

开发的时候&#xff0c;就是以横屏的样式开发的&#xff0c;所以横屏的展示效果就是&#xff1a; 当设备竖着的时候&#xff0c;会进行缩放&#xff0c;展示效果不友好&#xff0c;所以需要设备竖着的时候&#xff0c;也横屏显示&#xff1a; 实现原理就是&#xff1a;使用css监…

计算机毕业设计SpringBoot+Vue.js电影评论网站系统(源码+文档+PPT+讲解)

温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 作者简介&#xff1a;Java领…

Locale+Jackson导致Controller接口StackOverflowError异常解决

问题 由于参与的项目有出海需求&#xff0c;即需要给外国人使用&#xff0c;即&#xff1a;需要支持i18n&#xff08;Internationalization的缩写&#xff0c;共20个字母&#xff0c;除去首尾两个字母&#xff0c;中间有18个&#xff0c;故简称i18n&#xff09;。 本来是好的…