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

二进制源码部署mysql8.0.35

二进制部署mysql8.0.35

创建mysql用户
[root@zyq ~]#: useradd -r -s /sbin/nologin -M mysql
[root@zyq ~]#: id mysql 
uid=990(mysql) gid=990(mysql) groups=990(mysql)上传mysql文件
[root@zyq ~]#: ls
anaconda-ks.cfg  
mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz解压
[root@zyq ~]#: tar xf mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz -C  /usr/local/
[root@zyq ~]#: cd /usr/local/
[root@zyq local]#: ls
bin  games  include  lib64    mysql-8.0.35-linux-glibc2.28-x86_64  share
etc  httpd  lib      libexec  sbin                                 src
[root@zyq local]#: mv mysql-8.0.35-linux-glibc2.28-x86_64/ mysql设置环境变量
[root@zyq mysql]#: echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@zyq mysql]#: source /etc/profile.d/mysql.sh 
[root@zyq mysql]#: which mysql
/usr/local/mysql/bin/mysql创建软连接
[root@zyq mysql]#: ln -s /usr/local/mysql/include /usr/include/mysql配置lib库文件
[root@zyq mysql]#: vi /etc/ld.so.conf.d/mysql.conf
[root@zyq mysql]#: cat /etc/ld.so.conf.d/mysql.conf
/use/local/mysql/lib
[root@zyq mysql]#: ldconfig 配置man文档
[root@zyq mysql]#: vi /etc/man_db.conf
添加此行
......
MANDATORY_MANPATH                       /usr/local/mysql/man
......更改主/[root@zyq mysql]#: chown -R mysql.mysql /usr/local/mysql
[root@zyq mysql]#: ll /usr/local/mysql/
total 296
drwxr-xr-x.  2 mysql mysql   4096 Oct 12 22:11 bin
drwxr-xr-x.  2 mysql mysql     38 Oct 12 22:11 docs
drwxr-xr-x.  3 mysql mysql   4096 Oct 12 22:11 include
drwxr-xr-x.  6 mysql mysql   4096 Oct 12 22:11 lib
-rw-r--r--.  1 mysql mysql 279355 Oct 12 19:45 LICENSE
drwxr-xr-x.  4 mysql mysql     30 Oct 12 22:11 man
-rw-r--r--.  1 mysql mysql    666 Oct 12 19:45 README
drwxr-xr-x. 28 mysql mysql   4096 Oct 12 22:11 share
drwxr-xr-x.  2 mysql mysql     77 Oct 12 22:11 support-files创建数据库数据目录
初始化
[root@zyq mysql]#: mkdir /opt/data
[root@zyq mysql]#: mysqld --initialize --user=mysql --datadir=/opt/data/
2023-12-05T09:24:56.910277Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.35) initializing of server in progress as process 31786
2023-12-05T09:24:56.915155Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-12-05T09:24:57.047553Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-12-05T09:24:58.592274Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: n1O6QThtF;m=
保存密码方便查看
[root@zyq mysql]#: echo 'n1O6QThtF;mu' > pass配置my.cnf文件
[root@zyq mysql]#: vi /etc/my.cnf
[root@zyq mysql]#: cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve配置支持文件
[root@zyq mysql]#: cd support-files/
[root@zyq support-files]#: file mysql.server 
mysql.server: POSIX shell script, ASCII text executable
[root@zyq support-files]#: mkdir /etc/init.d
[root@zyq support-files]#: cp -a mysql.server /etc/init.d/mysqld
[root@zyq support-files]#: ll /etc/init.d/mysqld 
-rwxr-xr-x. 1 mysql mysql 10576 Oct 12 21:47 /etc/init.d/mysqld
指名路径(安装路径,数据路径)
[root@zyq support-files]#: vi /etc/init.d/mysqld 
basedir=/use/local/mysql
datadir=/opt/data启动
[root@zyq support-files]#: cd 
[root@zyq ~]#: systemctl daemon-reload 
[root@zyq ~]#: service mysqld start 
Starting MySQL.Logging to '/opt/data/zyq.err'.SUCCESS! 
[root@zyq ~]#: ss -antl
State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port  Process  
LISTEN  0       128            0.0.0.0:22           0.0.0.0:*              
LISTEN  0       511                  *:80                 *:*              
LISTEN  0       128               [::]:22              [::]:*              
LISTEN  0       70                   *:33060              *:*              
LISTEN  0       151                  *:3306               *:*              
停止服务
[root@zyq ~]#: service mysqld stop
Shutting down MySQL.. SUCCESS!用配置文件方式启动,停止服务
[root@zyq ~]#: cd /usr/lib/systemd/system
[root@zyq system]#: cp sshd.service mysql.service
[root@zyq system]#: vi mysql.service 
[root@zyq system]#: cat mysql.service 
[Unit]
Description=mysqld server daemon
After=network.target [Service]
Type=forking
ExecStart=service mysqld start
ExecStop=service mysqld stop
ExecReload=/bin/kill -HUP $MAINPID[Install]
WantedBy=multi-user.target
[root@zyq system]#: systemctl daemon-reload 
[root@zyq system]#: cd
[root@zyq ~]#: systemctl status mysql.service 
○ mysql.service - mysqld server daemonLoaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vend>Active: inactive (dead)[root@zyq ~]#: ss -antl
State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port  Process  
LISTEN  0       128            0.0.0.0:22           0.0.0.0:*              
LISTEN  0       511                  *:80                 *:*              
LISTEN  0       128               [::]:22              [::]:*              
[root@zyq ~]#: systemctl start mysql.service 
[root@zyq ~]#: ss -antl
State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port  Process  
LISTEN  0       128            0.0.0.0:22           0.0.0.0:*              
LISTEN  0       511                  *:80                 *:*              
LISTEN  0       128               [::]:22              [::]:*              
LISTEN  0       70                   *:33060              *:*              
LISTEN  0       151                  *:3306               *:*              
[root@zyq ~]#: systemctl status mysql.service 
● mysql.service - mysqld server daemonLoaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vend>Active: active (running) since Tue 2023-12-05 17:52:41 CST; 14s agoProcess: 32503 ExecStart=service mysqld start (code=exited, status=0/S>Main PID: 32524 (mysqld_safe)Tasks: 39 (limit: 48715)Memory: 370.6MCPU: 520msCGroup: /system.slice/mysql.service├─32524 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/o>└─32714 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysq>Dec 05 17:52:40 zyq systemd[1]: Starting mysqld server daemon...
Dec 05 17:52:41 zyq service[32507]: Starting MySQL. SUCCESS!
Dec 05 17:52:41 zyq systemd[1]: Started mysqld server daemon.设置开机自启
[root@zyq ~]#: systemctl enable mysql.service 
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /usr/lib/systemd/system/mysql.service.
[root@zyq ~]#: systemctl status mysql.service 
● mysql.service - mysqld server daemonLoaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendo>Active: active (running) since Tue 2023-12-05 17:52:41 CST; 2min 15s >Main PID: 32524 (mysqld_safe)Tasks: 38 (limit: 48715)Memory: 370.6MCPU: 1.075sCGroup: /system.slice/mysql.service├─32524 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/o>└─32714 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysq>Dec 05 17:52:40 zyq systemd[1]: Starting mysqld server daemon...
Dec 05 17:52:41 zyq service[32507]: Starting MySQL. SUCCESS!
Dec 05 17:52:41 zyq systemd[1]: Started mysqld server daemon.重启检测
[root@zyq ~]#: reboot
[root@zyq ~]#: ss -antl
State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port  Process  
LISTEN  0       128            0.0.0.0:22           0.0.0.0:*              
LISTEN  0       128               ::]:22              [::]:*              
LISTEN  0       70                   *:33060              *:*              
LISTEN  0       151                  *:3306               *:*  
设置数据库密码
使用初始化的密码登录
[root@zyq ~]#: mysql -uroot -p'n1O6QThtF;mu'mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'Pssword@_';

相关文章:

  • c++初阶------c++代码模块
  • c语言文件操作(下)
  • WEB测试之兼容性测试
  • cinder学习小结
  • JS——9大陷阱
  • 【前端Vue】Vue3+Pinia小兔鲜电商项目第3篇:静态结构搭建和分类实现,1. 整体结构创建【附代码文档】
  • 一键部署开源舆情系统
  • 开源博客项目Blog .NET Core源码学习(11:App.Core项目结构分析)
  • React 18中hook函数详解之useState和useEffect
  • Leetcode第35题:搜索插入位置
  • 【漏洞复现】WordPress Plugin NotificationX 存在sql注入CVE-2024-1698
  • Vue2(十一):全局事件总线、消息订阅与发布pubsub、TodoList的编辑功能、$nextTick、过渡与动画
  • 3-26 备赛
  • Java内存模型简述
  • 前段项目结构
  • ES学习笔记(12)--Symbol
  • iOS帅气加载动画、通知视图、红包助手、引导页、导航栏、朋友圈、小游戏等效果源码...
  • iOS小技巧之UIImagePickerController实现头像选择
  • Leetcode 27 Remove Element
  • Lucene解析 - 基本概念
  • PaddlePaddle-GitHub的正确打开姿势
  • PAT A1092
  • SSH 免密登录
  • vue2.0开发聊天程序(四) 完整体验一次Vue开发(下)
  • 大整数乘法-表格法
  • 入手阿里云新服务器的部署NODE
  • 为什么要用IPython/Jupyter?
  • 小而合理的前端理论:rscss和rsjs
  • 阿里云ACE认证之理解CDN技术
  • ​ ​Redis(五)主从复制:主从模式介绍、配置、拓扑(一主一从结构、一主多从结构、树形主从结构)、原理(复制过程、​​​​​​​数据同步psync)、总结
  • #DBA杂记1
  • #我与虚拟机的故事#连载20:周志明虚拟机第 3 版:到底值不值得买?
  • (02)vite环境变量配置
  • (1/2) 为了理解 UWP 的启动流程,我从零开始创建了一个 UWP 程序
  • (aiohttp-asyncio-FFmpeg-Docker-SRS)实现异步摄像头转码服务器
  • (搬运以学习)flask 上下文的实现
  • .cfg\.dat\.mak(持续补充)
  • .md即markdown文件的基本常用编写语法
  • .NET C# 使用 SetWindowsHookEx 监听鼠标或键盘消息以及此方法的坑
  • .NET Framework 服务实现监控可观测性最佳实践
  • .Net MVC4 上传大文件,并保存表单
  • .net mvc部分视图
  • .NET Remoting Basic(10)-创建不同宿主的客户端与服务器端
  • .NET 中 GetProcess 相关方法的性能
  • ;号自动换行
  • @Bean注解详解
  • @JSONField或@JsonProperty注解使用
  • @reference注解_Dubbo配置参考手册之dubbo:reference
  • @RequestMapping 的作用是什么?
  • @Transient注解
  • [ SNOI 2013 ] Quare
  • [2010-8-30]
  • [2024] 十大免费电脑数据恢复软件——轻松恢复电脑上已删除文件
  • [AI]文心一言出圈的同时,NLP处理下的ChatGPT-4.5最新资讯
  • [BZOJ] 2427: [HAOI2010]软件安装