mysql二进制安装...

一.下载链接

https://mirrors.aliyun.com/mysql/MySQL-8.0/mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz

二.官方下载文档

MySQL :: MySQL 8.3 Reference Manual :: 2.2 Installing MySQL on Unix/Linux Using Generic Binaries

三.开始下载

3.1.获取软件包

-rw-r--r--  1 root root 1.2G  3月  7 11:20 mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz

3.2.安装

因为yum方式下载过来做了下参照
[root@node1 ~]# groupadd -g 27 -r mysql
[root@node1 ~]# useradd -u 27 -g 27 -c 'MYSQL Server' -r -s /sbin/nologin mysql
[root@node1 ~]# tail -1 /etc/passwd
mysql:x:27:27:MYSQL Server:/home/mysql:/sbin/nologin

 #就是单纯参照安装文档一步不落的做一遍

[root@node1 ~]#  tar xf /root/mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz -C /usr/local/
创建软连接(换名)
[root@node1 local]# ln -sv /usr/local/mysql-8.0.28-linux-glibc2.12-x86_64/ /usr/local/mysql
'/usr/local/mysql' -> '/usr/local/mysql-8.0.28-linux-glibc2.12-x86_64/'
[root@node1 local]# cd mysql
[root@node1 mysql]# mkdir mysql-files
[root@node1 mysql]# chown mysql:mysql mysql-files
[root@node1 mysql]# chmod 750 mysql-files
安装初始化,会产生密码
[root@node1 mysql]# bin/mysqld --initialize --user=mysql
2024-03-07T03:41:13.560187Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.28-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.28) initializing of server in progress as process 2019
2024-03-07T03:41:13.576251Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-03-07T03:41:14.149745Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-03-07T03:41:15.543105Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8h.o8s<qNIM3
mysql服务开启ssl加密功能,安装和启用 ssl,不启用 ssl 可忽略这一步
[root@node1 mysql]# bin/mysql_ssl_rsa_setup
[root@node1 mysql]# bin/mysqld_safe --user=mysql &

 3.3.配置环境变量

为了在在任何文件夹下都调用到某一指定目录下的文件,我们就应该配置环境变量(指定目录路径),让系统在你所配置的路径下去自己查找这些文件然后运行,而不用我们去手动打开这些文件所在目录再运行

[root@node1 mysql]# vi /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin/
[root@node1 mysql]# source /etc/profile.d/mysql.sh

3.4.启动,报错 ,解决,成功

启动,报错
[root@node1 mysql]# mysql -uroot -p'8h.o8s<qNIM3'
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory


解决:
[root@node1 mysql]# yum install ncurses-compat-libs
再启动:
[root@node1 mysql]# mysql -uroot -p'8h.o8s<qNIM3'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28

Copyright (c) 2000, 2022, 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> 

 3.5.修改密码

[root@node1 mysql]# mysqladmin -uroot -p'8h.o8s<qNIM3' password 'Mnwl_0816'
[root@node1 mysql]# mysql -uroot -p'Mnwl_0816'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.28 MySQL Community Server - GPL

Copyright (c) 2000, 2022, 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> 

3.6.提供服务脚本

[root@node1 mysql]# mysqladmin -uroot -p'Mnwl_0816' shutdown

添加 mysql 服务到系统服务
[root@node1 mysql]# cp support-files/mysql.server /etc/init.d/mysql.server

[root@node1 mysql]# chkconfig --add mysqld

 3.7.从yum安装的机子中拷一份配置文件

[root@node1 mysql]# scp -r 192.168.32.132:/etc/my.cnf.d/ /etc/
[root@node1 mysql]# scp -r 192.168.32.132:/etc/my.cnf /etc/

3.8.修改相关参数

[root@node1 my.cnf.d]# vim mysql-server.cnf 

basedir=/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

3.9.重启报错-已解决

原来是有进程在进行

 

相关推荐

  1. 二进制方式安装mysql

    2024-03-11 16:34:01       11 阅读
  2. mysql笔记(二进制安装+使用+多实例)

    2024-03-11 16:34:01       14 阅读
  3. 在Unix/Linux上使用通用二进制文件安装MySQL

    2024-03-11 16:34:01       30 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-11 16:34:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-11 16:34:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-11 16:34:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-11 16:34:01       18 阅读

热门阅读

  1. 解决Git中fatal: refusing to merge unrelated histories

    2024-03-11 16:34:01       24 阅读
  2. 【C/C++ 学习笔记】数组

    2024-03-11 16:34:01       25 阅读
  3. LeetCode:猜数字游戏

    2024-03-11 16:34:01       23 阅读
  4. LeetCode每日一题[C++]-猜数字游戏

    2024-03-11 16:34:01       23 阅读
  5. 基本工具学习--宝藏“课程”

    2024-03-11 16:34:01       18 阅读
  6. AcWing 1211. 蚂蚁感冒

    2024-03-11 16:34:01       22 阅读
  7. sora未来在哪里,是否改变世界

    2024-03-11 16:34:01       21 阅读
  8. 2024 年 AI 辅助研发趋势

    2024-03-11 16:34:01       20 阅读
  9. sqlite 损坏 修复

    2024-03-11 16:34:01       21 阅读
  10. C语言基础练习——Day04

    2024-03-11 16:34:01       20 阅读
  11. 如何像专家一样维护服务器硬件?

    2024-03-11 16:34:01       18 阅读