4、slurm基本环境之mysql安装

根据上文这里在centos7.6进行mysql8.0的安装

操作系统slurm版本mysqlmungepmixOpenMPI/intelMPI
centos7.6slurm-24.11MySQL 8.00.5.15v4.xv4.1.x/2021
  1. mysql安装包下载
    链接: mysql阿里镜像下载链接,点击下述版本进行安装。
    在这里插入图片描述

下载完成后我们准备shell工具上传至centos7.6服务器(虚拟机),可选的工具很多,本文选择MobaXterm( shell工具下载链接),选择免费版即可:
在这里插入图片描述
点击下载压缩包
.cn/direct/f18610b4b44a415298869189000ba47b.png)
解压压缩包,执行exe
在这里插入图片描述
打开在vmvare中已经安装好的centos7.6,右键桌面,打开终端
在这里插入图片描述
键入以下命令,查看节点的ip。

ifconfig

这里为192.168.99.186。之后在双击打开的mobaxterm。按照下图提示输入IP.
在这里插入图片描述
之后点击ok,accept.输入centos7.6用户的密码。
在这里插入图片描述
登入用户。找到下载mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz,按鼠标拖入mobaxterm的打开的终端/root/目录下
在这里插入图片描述
如果上传出错将mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz改名为mysql.tar.xz重试上传。
之后在mobaxterm终端中执行解压操作,有以下输出。

[root@localhost ~]# tar -xvf mysql.tar.xz
mysql-8.0.27-linux-glibc2.12-x86_64/bin/
mysql-8.0.27-linux-glibc2.12-x86_64/bin/myisam_ftdump
mysql-8.0.27-linux-glibc2.12-x86_64/bin/myisamchk
mysql-8.0.27-linux-glibc2.12-x86_64/bin/myisamlog
mysql-8.0.27-linux-glibc2.12-x86_64/bin/myisampack
.
.
.
mysql-8.0.27-linux-glibc2.12-x86_64/share/install_rewriter.sql
mysql-8.0.27-linux-glibc2.12-x86_64/share/uninstall_rewriter.sql
[root@localhost ~]# ll mysql-8.0.27-linux-glibc2.12-x86_64
total 288
drwxr-xr-x.  2 7161 31415   4096 Sep 28  2021 bin
drwxr-xr-x.  2 7161 31415     55 Sep 28  2021 docs
drwxr-xr-x.  3 7161 31415   4096 Sep 28  2021 include
drwxr-xr-x.  6 7161 31415    201 Sep 28  2021 lib
-rw-r--r--.  1 7161 31415 276550 Sep 28  2021 LICENSE
drwxr-xr-x.  4 7161 31415     30 Sep 28  2021 man
-rw-r--r--.  1 7161 31415    666 Sep 28  2021 README
drwxr-xr-x. 28 7161 31415   4096 Sep 28  2021 share
drwxr-xr-x.  2 7161 31415     77 Sep 28  2021 support-files
[root@localhost ~]#

卸载系统原有mariadb

[root@localhost ~]# yum remove -y mariadb-libs
[root@localhost ~]# sudo rm -rf /var/lib/mysql
[root@localhost ~]# sudo rm -rf /etc/my.cn

移动二进制包到新目录,后续软件都将安装到此目录以便于管理

[root@localhost ~]# mv mysql-8.0.27-linux-glibc2.12-x86_64 /opt/
[root@localhost ~]# cd /opt/
[root@localhost opt]# ll mysql-8.0.27-linux-glibc2.12-x86_64
total 288
drwxr-xr-x.  2 7161 31415   4096 Sep 28  2021 bin
drwxr-xr-x.  2 7161 31415     55 Sep 28  2021 docs
drwxr-xr-x.  3 7161 31415   4096 Sep 28  2021 include
drwxr-xr-x.  6 7161 31415    201 Sep 28  2021 lib
-rw-r--r--.  1 7161 31415 276550 Sep 28  2021 LICENSE
drwxr-xr-x.  4 7161 31415     30 Sep 28  2021 man
-rw-r--r--.  1 7161 31415    666 Sep 28  2021 README
drwxr-xr-x. 28 7161 31415   4096 Sep 28  2021 share
drwxr-xr-x.  2 7161 31415     77 Sep 28  2021 support-files

创建mysql用户

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

创建mysql的数据目录、设置目录权限及读写权限

[root@localhost opt]# mkdir -p  /opt/mysql/data
[root@localhost opt]# chown -R mysql:mysql /opt/mysql/data
[root@localhost opt]# chmod -R 755 /opt/mysql

初始化 MySQL

[root@localhost mysql]# /opt/mysql-8.0.27-linux-glibc2.12-x86_64/bin/mysqld --initialize --user=mysql --datadir=/opt/mysql/data --basedir=/opt/mysql-8.0.27-linux-glibc2.12-x86_64
2025-03-07T14:00:45.662433Z 0 [System] [MY-013169] [Server] /opt/mysql-8.0.27-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 19514
2025-03-07T14:00:45.677776Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-03-07T14:00:46.145111Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-03-07T14:00:47.152112Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2025-03-07T14:00:47.152143Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2025-03-07T14:00:47.234229Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 6n;N2j97>X,j

初始化后,MySQL 会生成 root 初始密码,这里是最后一行 A temporary password is generated for root@localhost:后的字段:

6n;N2j97>X,j

创建 MySQL 配置文件:

[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# vim /etc/my.cnf

进入vim编辑器,按小写的i进入编辑模式(插入模式),复制下述的字段,粘贴到打开的vim编辑器中。

[mysqld]
basedir=/opt/mysql-8.0.27-linux-glibc2.12-x86_64
datadir=/opt/mysql/data
socket=/opt/mysql/mysql.sock
pid-file=/opt/mysql/mysqld.pid
port=3306
user=mysql

复制完成后,按下esc退出vim的编辑模式,同时按下“shift+:”键,输入wq回车后进行退出vim编辑器。
在这里插入图片描述
配置环境变量

[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# echo 'export PATH=/opt/mysql-8.0.27-linux-glibc2.12-x86_64/bin:$PATH' >> /etc/profile.d/mysql.sh
[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# source /etc/profile.d/mysql.sh

启动 MySQL

[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# cp /opt/mysql-8.0.27-linux-glibc2.12-x86_64/support-files/mysql.server /etc/init.d/mysql
[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# chmod +x /etc/init.d/mysql
[root@localhost data]# /etc/init.d/mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/mysqld.pid).

如果出现上述错误
再次给目录添加权限,即可启动mysql。

[root@localhost data]# chown -R mysql:mysql  /opt/mysql/
[root@localhost data]# chmod -R 755 /opt/mysql/
[root@localhost data]# /etc/init.d/mysql start
Starting MySQL. SUCCESS!

设置 MySQL 开机自启

[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# chkconfig --add mysql
[root@localhost mysql-8.0.27-linux-glibc2.12-x86_64]# chkconfig mysql on

修改 root 密码,输入你刚才生成的临时密码,(我这里是6n;N2j97>X,j根据你自己环境生成的进行替换)进行修改密码,密码记得保存,后续会用到。

[root@localhost data]# mysql -u root -p --socket=/opt/mysql/mysql.sock --port=3306
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.27

Copyright (c) 2000, 2021, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
Query OK, 0 rows affected (0.01 sec)

mysql>


按ctrl+D,可退出mysql。此时完成mysql的安装,查看mysql的版本

[root@localhost data]# /opt/mysql-8.0.27-linux-glibc2.12-x86_64/bin/mysql_config --version
8.0.27

另外在编译slurm时,检查是否安装mysql插件时也是根据此文件来生成对应的动态库,/opt/mysql-8.0.27-linux-glibc2.12-x86_64/bin/mysql_config。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值