首页 > 数据库 >rhel 7.3安装mysql 8.0.27

rhel 7.3安装mysql 8.0.27

时间:2023-05-26 19:32:08浏览次数:55  
标签:opt 8.0 27 -- leo 7.3 master mysql root

文档课题:rhel 7.3安装mysql 8.0.27.
系统:rhel 7.3 64位
数据库:mysql 8.0.27
安装包:mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz
1、安装前检查
1.1、系统版本
[root@leo-mysql-master ~]# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.3 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Red Hat Enterprise Linux Server release 7.3 (Maipo)
1.2、确认安装情况
--检查是否安装mysql.
[root@leo-mysql-master ~]# rpm -qa | grep mysql
--检查是否存在mysql用户.
[root@leo-mysql-master ~]# id mysql
id: mysql: no such user 
1.3、检查库文件
--检查库文件是否安装.
[root@leo-mysql-master ~]# rpm -qa | grep libaio
libaio-0.3.109-13.el7.x86_64
说明:若未安装库文件,则需要安装.
[root@leo-mysql-master ~]# yum -y install libaio-devel.x86_64
[root@leo-mysql-master ~]# yum -y install numactl
2、开始安装
2.1、建组和用户
--新建mysql组和mysql用户.
[root@leo-mysql-master ~]# groupadd mysql
[root@leo-mysql-master ~]# useradd -r -g mysql mysql
2.2、软件包处理
--上传mysql软件包.
sftp> lcd F:\installmedium\mysql
sftp> put mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz
--解压安装包.
[root@leo-mysql-master ~]# tar -xvf mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz
--重命名.
[root@leo-mysql-master ~]# mkdir -p /opt
[root@leo-mysql-master ~]# mv mysql-8.0.27-linux-glibc2.12-x86_64 /opt/mysql
[root@leo-mysql-master opt]# chown -R root:root /opt/mysql
--建数据存储目录.
[root@leo-mysql-master mysql]# mkdir -p /opt/mysql/data
[root@leo-mysql-master mysql]# chown mysql:mysql /opt/mysql/data
2.3、初始化数据库
[root@leo-mysql-master ~]# ll /etc/ | grep my.cnf
-rw-r--r--.  1 root root      570 Sep 21  2016 my.cnf
drwxr-xr-x.  2 root root       31 May 26 15:35 my.cnf.d
[root@leo-mysql-master ~]# mv /etc/my.cnf /etc/my.cnf.bak
[root@leo-mysql-master ~]# ll /etc/ | grep my.cnf
-rw-r--r--.  1 root root      570 Sep 21  2016 my.cnf.bak
drwxr-xr-x.  2 root root       31 May 26 15:35 my.cnf.d
开始初始化
[root@leo-mysql-master ~]# /opt/mysql/bin/mysqld --initialize --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data
2023-05-26T08:27:50.200958Z 0 [System] [MY-013169] [Server] /opt/mysql/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 47423
2023-05-26T08:27:50.208997Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-05-26T08:27:50.773990Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-05-26T08:27:51.731006Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2023-05-26T08:27:51.731046Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2023-05-26T08:27:51.863805Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: )YoTudkto5sK

说明:注意复制初始化密码)YoTudkto5sK
2.4、修改配置文件
--进入mysql安装目录support-files,创建mysql-default.cnf文件并添加权限.
[root@leo-mysql-master ~ ]# cd /opt/mysql/support-files
[root@leo-mysql-master support-files]# touch mysql-default.cnf
[root@leo-mysql-master support-files]# chmod 777 mysql-default.cnf
[root@leo-mysql-master support-files]# ll
total 20
-rwxrwxrwx. 1 root root     0 May 26 16:30 mysql-default.cnf
-rwxr-xr-x. 1 root root  1061 Sep 28  2021 mysqld_multi.server
-rw-r--r--. 1 root root  2027 Sep 28  2021 mysql-log-rotate
-rwxr-xr-x. 1 root root 10576 Sep 28  2021 mysql.server
--将其复制到/etc下,并改名为my.cnf.
[root@leo-mysql-master support-files]# cp -a mysql-default.cnf /etc/my.cnf
[root@leo-mysql-master ~]# vi /etc/my.cnf
添加如下:
[mysqld]
basedir=/opt/mysql
datadir=/opt/mysql/data
socket=/tmp/mysql.sock
log-error=/opt/mysql/data/error.log
pid-file=/opt/mysql/data/mysql.pid
port=3306
max_allowed_packet=32M
--修改配置文件权限.
[root@leo-mysql-master ~]# chmod 644 /etc/my.cnf
2.5、关闭防火墙
[root@leo-mysql-master ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2023-05-26 15:43:25 CST; 1h 10min ago
     Docs: man:firewalld(1)
 Main PID: 878 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─878 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

May 26 15:43:25 leo-mysql-master systemd[1]: Starting firewalld - dynamic firewall daemon...
May 26 15:43:25 leo-mysql-master systemd[1]: Started firewalld - dynamic firewall daemon.
[root@leo-mysql-master ~]# systemctl stop firewalld
[root@leo-mysql-master ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
3、设置开启自启
3.1、mysql服务处理
--复制mysql服务文件到/etc/init.d目录,重命名为mysql.
[root@leo-mysql-master ~]# cp -a /opt/mysql/support-files/mysql.server /etc/init.d/mysql
[root@leo-mysql-master ~]# ll /etc/init.d/mysql
-rwxr-xr-x. 1 root root 10576 Sep 28  2021 /etc/init.d/mysql
--添加可执行权限.
[root@leo-mysql-master ~]# chmod +x /etc/init.d/mysql
--注册服务.
[root@leo-mysql-master ~]# chkconfig --add mysql
--检测.
[root@leo-mysql-master ~]# chkconfig --list mysql

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]'.

mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off
3.2、环境变量处理
/etc/ld.so.conf要配置路径,否则报错
[root@leo-mysql-master ~]# vi /etc/ld.so.conf
--添加mysql的lib文件
/opt/mysql/lib

--配置环境变量.
[root@leo-mysql-master ~]# vi /etc/profile
添加如下:
export PATH=$PATH:/opt/mysql/bin:/opt/mysql/lib

--重新加载使环境变量生效.
[root@leo-mysql-master ~]# source /etc/profile

4、修改默认密码
--启动服务.
[root@leo-mysql-master ~]# service mysql start
Starting MySQL.Logging to '/opt/mysql/data/error.log'.
 SUCCESS!
[root@leo-mysql-master ~]# ps -ef|grep mysql
avahi       848      1  0 15:43 ?        00:00:00 avahi-daemon: running [leo-mysql-master.local]
root      47855      1  0 16:50 pts/2    00:00:00 /bin/sh /opt/mysql/bin/mysqld_safe --datadir=/opt/mysql/data --pid-file=/opt/mysql/data/mysql.pid
mysql     48032  47855  5 16:50 pts/2    00:00:00 /opt/mysql/bin/mysqld --basedir=/opt/mysql --datadir=/opt/mysql/data --plugin-dir=/opt/mysql/lib/plugin --user=mysql --log-error=/opt/mysql/data/error.log --pid-file=/opt/mysql/data/mysql.pid --socket=/tmp/mysql.sock --port=3306
root      48089  14757  0 16:50 pts/2    00:00:00 grep --color=auto mysql
[root@leo-mysql-master ~]# mysql -uroot -p
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 'mysql_4U';
Query OK, 0 rows affected (0.01 sec)

参考文档:https://blog.csdn.net/weixin_45648789/article/details/129033802?spm=1001.2014.3001.5502

标签:opt,8.0,27,--,leo,7.3,master,mysql,root
From: https://blog.51cto.com/u_12991611/6358381

相关文章

  • [abc279 G] At Most 2 Colors
    G-AtMost2Colors(atcoder.jp)重点讲解方法三,因为方法三是蒟蒻都能想出来的方法一和方法二都可以借助方法三的思想推出方法一这是最简单的设置状态的方法,\(dp[i]\)表示前\(i\)个的方案数,然后分类若\([i-k+1,i-1]\)有两种颜色那么第\(i\)位的取值肯定时这两种颜色中......
  • (ADI)AD7276ARMZ高速模数转换器、A4980KLPTR汽车步进电机驱动器
    AD7276ARMZ是(ADI)的高速模数转换器、数模转换器和AFE/CODEC构成了业界知名的高速数据转换器产品组合。该器件具有出色性能、高输入带宽和集成的信号处理,使设计人员能够轻松、可靠地选择合适的方案用于各种应用,包括仪表、军用/航天、无线/有线通信和医学影像。位数:12采样率(每......
  • Jmeter函数助手27-urlencode
    urlencode函数用于将字符串进行application/x-www-form-urlencoded编码格式化。StringtoencodeinURLencodedchars:填入字符 1、urlencode函数将字符进行编码格式化,而urldecode函数则是将编码进行解码,两者功能刚好相反。${__urlencode(value="hello"+"word"&name="名......
  • AT_abc271_c 总结
    题目:AT_abc271_c链接:洛谷,AT,vjudge题意有\(n\)本漫画书,第\(i\)本的有卷数\(a_i\),在看漫画前可以执行若干次操作:将任意两本漫画书换成一本任意卷数的漫画书。一个人会按顺序看漫画的第\(1,2,\dots\)卷,当他手上没有下一卷要读的漫画时,将会停止阅读。问这个人最多可......
  • ubauntu18.04下出现Invalid YAML: inconsistent indentation: version: 2问题解决
    在配置网卡信息时候遇到如上问题查询后有几种可能错误的地方:未能通过yaml语法和缩进,YAML在解释命令、配置参数这方面十分注重语法和缩进,只有适当缩进才能够解析YAML配置网络配置出现故障,IP地址的网关不正确,或者掩码配置失误那么我们现在在网络配置正确前提下最重要就是了解缩进工作......
  • WSL 启动Ubuntu18.04默认设置网络和开启SSH
    1、wsl-ip.bat脚本@echoonREM先关闭虚拟子系统wsl--shutdownREM以下的Ubuntu为第2步查到的Linux子系统名称REMIP地址根据自己的需要配置wsl-dUbuntu-18.04-urootipaddrdel$(ipaddrshoweth0^|grep'inet\b'^|awk'{print$2}'^|head-n1)deveth0w......
  • CS9027兼容DRV8812,CS9029兼容DRV8841,双通道H桥电机驱动芯片
    CS9027C为打印机和其它电机一体化应用提供一种双通道集成电机驱动方案。CS9027C有两路H桥驱动,每个H桥可提供最大输出电流2A(在24V和Ta=25C适当散热条件下),可驱动两个刷式直流电机,或者一个双极步进电机,或者螺线管或者其它感性负载。双极步进电机可以以整步、2细分、4细分运行,或者......
  • Firefox8.0.1及对应firebug1.9.0,firepath0.9.7.1.1插件下载
    firefox8.0.1链接:https://pan.baidu.com/s/1x9M6dimmvQrBee_iSeVcZg提取码:ewy8旧版本安装注意,安装前必看:firefox旧版本下载后打开为为最新版怎么办firebug1.9.0链接:https://pan.baidu.com/s/1g55zj8BjciR4U3Mn1ApqFQ提取码:zfj3firepath0.9.7.1.1链接:https://pan.baidu.com/s/......
  • OverTheWire攻关过程-Bandit模块27
    我们打开lv26-lv27,查看信息机器翻译好工作得到一个壳!现在赶紧抢匪27的密码!我们登陆服务器我们发现一登录就发现断开猜想,有没有可能跟25关卡一样由于tabby的窗口不是系统的原生窗口我们输入V,进入编辑模式:setshellsh=/bin/sh使用ls查看文件可以看到有sudo执行的文件使用命令./ban......
  • day01【704. 二分查找,35.搜索插入位置 ,27. 移除元素 】
    704.二分查找二分查找理论二分查找是一个时间效率极高的算法,尤其是面对大量的数据时,其查找效率是极高,时间复杂度是log(n)。主要思想就是不断的对半折叠,每次查找都能除去一半的数据量,直到最后将所有不符合条件的结果都去除,只剩下一个符合条件的结果。二分查找需要的条件用于......