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

linux系统使用yum安装mysql5.6版本的流程

1.下载安装包及依赖包

MySQL :: Download MySQL Community Server (Archived Versions)

[root@localhost localrepo]# ls
MySQL-client-5.6.47-1.el7.x86_64.rpm    
MySQL-server-5.6.47-1.el7.x86_64.rpm         
MySQL-test-5.6.47-1.el7.x86_64.rpm
MySQL-devel-5.6.47-1.el7.x86_64.rpm     
mysql-shared-5.6.47-1.el7.x86_64.rpm         
MySQL-embedded-5.6.47-1.el7.x86_64.rpm  
MySQL-shared-compat-5.6.47-1.el7.x86_64.rpm

2.把上述的rpm文件都使用yum -y install ./xx.rpm安装

注意: client和server的rpm包应该在最后安装

比如:

[root@localhost ~]# yum -y install MySQL-embedded.x86_64
仓库 'local_repo' 在配置中缺少名称,将使用 id。
上次元数据过期检查:0:00:34 前,执行于 2024年08月23日 星期五 13时21分33秒。
错误:问题: 冲突的请求- 没有东西可提供 libncurses.so.5()(64bit)(MySQL-embedded-5.6.47-1.el7.x86_64 需要)- 没有东西可提供 libtinfo.so.5()(64bit)(MySQL-embedded-5.6.47-1.el7.x86_64 需要)
(尝试添加 '--skip-broken' 来跳过无法安装的软件包 或 '--nobest' 来不只使用软件包的最佳候选)
[root@localhost ~]# yum -y install MySQL-shared.x86_64
仓库 'local_repo' 在配置中缺少名称,将使用 id。
上次元数据过期检查:0:00:51 前,执行于 2024年08月23日 星期五 13时21分33秒。
依赖关系解决。
=============================================================================================================================================================软件包                                 架构                             版本                                     仓库                                  大小
=============================================================================================================================================================
安装:MySQL-shared                           x86_64                           5.6.47-1.el7                             local_repo                           4.1 M事务概要
=============================================================================================================================================================
安装  1 软件包总计:4.1 M
安装大小:17 M
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务准备中  :                                                                                                                                              1/1安装    : MySQL-shared-5.6.47-1.el7.x86_64                                                                                                             1/1运行脚本: MySQL-shared-5.6.47-1.el7.x86_64                                                                                                             1/1验证    : MySQL-shared-5.6.47-1.el7.x86_64                                                                                                             1/1已安装:MySQL-shared-5.6.47-1.el7.x86_64完毕!

注意: 有警告需要安装 libtinfo.so.5

[root@localhost ~]# yum provides libtinfo.so.5
仓库 'app' 在配置中缺少名称,将使用 id。
仓库 'base' 在配置中缺少名称,将使用 id。
仓库 'local_repo' 在配置中缺少名称,将使用 id。
app                                                                                                                          128 MB/s | 7.8 MB     00:00
base                                                                                                                         107 MB/s | 2.6 MB     00:00
local_repo                                                                                                                   1.7 MB/s |  63 kB     00:00
ncurses-compat-libs-6.1-9.20180224.el8.i686 : Ncurses compatibility libraries
仓库        :base
匹配来源:
提供    : libtinfo.so.5[root@localhost ~]# yum -y install ncurses-compat-libs-6.1-9.20180224.el8.i686
仓库 'app' 在配置中缺少名称,将使用 id。
仓库 'base' 在配置中缺少名称,将使用 id。
仓库 'local_repo' 在配置中缺少名称,将使用 id。
上次元数据过期检查:0:00:16 前,执行于 2024年08月23日 星期五 13时23分56秒。
依赖关系解决。
=============================================================================================================================================================软件包                                       架构                          版本                                         仓库                           大小
=============================================================================================================================================================
安装:ncurses-compat-libs                          i686                          6.1-9.20180224.el8                           base                          346 k
安装依赖关系:glibc                                        i686                          2.28-189.1.el8                               base                          2.0 Mlibgcc                                       i686                          8.5.0-10.el8                                 base                           86 klibstdc++                                    i686                          8.5.0-10.el8                                 base                          489 k事务概要
=============================================================================================================================================================
安装  4 软件包总计:2.9 M
安装大小:7.9 M
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务准备中  :                                                                                                                                              1/1安装    : libgcc-8.5.0-10.el8.i686                                                                                                                     1/4运行脚本: libgcc-8.5.0-10.el8.i686                                                                                                                     1/4运行脚本: glibc-2.28-189.1.el8.i686                                                                                                                    2/4安装    : glibc-2.28-189.1.el8.i686                                                                                                                    2/4运行脚本: glibc-2.28-189.1.el8.i686                                                                                                                    2/4安装    : libstdc++-8.5.0-10.el8.i686                                                                                                                  3/4运行脚本: libstdc++-8.5.0-10.el8.i686                                                                                                                  3/4安装    : ncurses-compat-libs-6.1-9.20180224.el8.i686                                                                                                  4/4运行脚本: ncurses-compat-libs-6.1-9.20180224.el8.i686                                                                                                  4/4验证    : glibc-2.28-189.1.el8.i686                                                                                                                    1/4验证    : libgcc-8.5.0-10.el8.i686                                                                                                                     2/4验证    : libstdc++-8.5.0-10.el8.i686                                                                                                                  3/4验证    : ncurses-compat-libs-6.1-9.20180224.el8.i686                                                                                                  4/4已安装:glibc-2.28-189.1.el8.i686         libgcc-8.5.0-10.el8.i686         libstdc++-8.5.0-10.el8.i686         ncurses-compat-libs-6.1-9.20180224.el8.i686完毕!

3.继续安装rpm包

4.最后安装server的rpm包会提示临时密码:

[root@localhost localrepo]# yum -y install MySQL-server-5.6.47-1.el7.x86_64.rpm
仓库 'app' 在配置中缺少名称,将使用 id。
仓库 'base' 在配置中缺少名称,将使用 id。
仓库 'local_repo' 在配置中缺少名称,将使用 id。
上次元数据过期检查:0:03:18 前,执行于 2024年08月23日 星期五 13时23分56秒。
依赖关系解决。
=============================================================================================================================================================软件包                                 架构                             版本                                   仓库                                    大小
=============================================================================================================================================================
安装:MySQL-server                           x86_64                           5.6.47-1.el7                           @commandline                            86 M事务概要
=============================================================================================================================================================
安装  1 软件包总计:86 M
安装大小:351 M
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务准备中  :                                                                                                                                              1/1运行脚本: MySQL-server-5.6.47-1.el7.x86_64                                                                                                             1/1安装    : MySQL-server-5.6.47-1.el7.x86_64                                                                                                             1/1
警告:user mysql does not exist - using root
警告:group mysql does not exist - using root
警告:user mysql does not exist - using root
警告:group mysql does not exist - using root运行脚本: MySQL-server-5.6.47-1.el7.x86_64                                                                                                             1/1
user2024-08-23 13:27:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-08-23 13:27:39 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2024-08-23 13:27:39 0 [Note] /usr/sbin/mysqld (mysqld 5.6.47) starting as process 19903 ...
2024-08-23 13:27:39 19903 [Note] InnoDB: Using atomics to ref count buffer pool pages
2024-08-23 13:27:39 19903 [Note] InnoDB: The InnoDB memory heap is disabled
2024-08-23 13:27:39 19903 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2024-08-23 13:27:39 19903 [Note] InnoDB: Memory barrier is not used
2024-08-23 13:27:39 19903 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-08-23 13:27:39 19903 [Note] InnoDB: Using Linux native AIO
2024-08-23 13:27:39 19903 [Note] InnoDB: Using CPU crc32 instructions
2024-08-23 13:27:39 19903 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2024-08-23 13:27:39 19903 [Note] InnoDB: Completed initialization of buffer pool
2024-08-23 13:27:39 19903 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2024-08-23 13:27:39 19903 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2024-08-23 13:27:39 19903 [Note] InnoDB: Database physically writes the file full: wait...
2024-08-23 13:27:40 19903 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2024-08-23 13:27:40 19903 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2024-08-23 13:27:41 19903 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2024-08-23 13:27:41 19903 [Warning] InnoDB: New log files created, LSN=45781
2024-08-23 13:27:41 19903 [Note] InnoDB: Doublewrite buffer not found: creating new
2024-08-23 13:27:41 19903 [Note] InnoDB: Doublewrite buffer created
2024-08-23 13:27:41 19903 [Note] InnoDB: 128 rollback segment(s) are active.
2024-08-23 13:27:41 19903 [Warning] InnoDB: Creating foreign key constraint system tables.
2024-08-23 13:27:41 19903 [Note] InnoDB: Foreign key constraint system tables created
2024-08-23 13:27:41 19903 [Note] InnoDB: Creating tablespace and datafile system tables.
2024-08-23 13:27:41 19903 [Note] InnoDB: Tablespace and datafile system tables created.
2024-08-23 13:27:41 19903 [Note] InnoDB: Waiting for purge to start
2024-08-23 13:27:41 19903 [Note] InnoDB: 5.6.47 started; log sequence number 0
2024-08-23 13:27:41 19903 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2024-08-23 13:27:41 19903 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2024-08-23 13:27:41 19903 [Note] Binlog end
2024-08-23 13:27:41 19903 [Note] InnoDB: FTS optimize thread exiting.
2024-08-23 13:27:41 19903 [Note] InnoDB: Starting shutdown...
2024-08-23 13:27:43 19903 [Note] InnoDB: Shutdown completed; log sequence number 1625977
A random root password has been set. You will find it in '/root/.mysql_secret'.2024-08-23 13:27:43 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-08-23 13:27:43 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2024-08-23 13:27:43 0 [Note] /usr/sbin/mysqld (mysqld 5.6.47) starting as process 19949 ...
2024-08-23 13:27:43 19949 [Note] InnoDB: Using atomics to ref count buffer pool pages
2024-08-23 13:27:43 19949 [Note] InnoDB: The InnoDB memory heap is disabled
2024-08-23 13:27:43 19949 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2024-08-23 13:27:43 19949 [Note] InnoDB: Memory barrier is not used
2024-08-23 13:27:43 19949 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-08-23 13:27:43 19949 [Note] InnoDB: Using Linux native AIO
2024-08-23 13:27:43 19949 [Note] InnoDB: Using CPU crc32 instructions
2024-08-23 13:27:43 19949 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2024-08-23 13:27:43 19949 [Note] InnoDB: Completed initialization of buffer pool
2024-08-23 13:27:43 19949 [Note] InnoDB: Highest supported file format is Barracuda.
2024-08-23 13:27:43 19949 [Note] InnoDB: 128 rollback segment(s) are active.
2024-08-23 13:27:43 19949 [Note] InnoDB: Waiting for purge to start
2024-08-23 13:27:43 19949 [Note] InnoDB: 5.6.47 started; log sequence number 1625977
2024-08-23 13:27:43 19949 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2024-08-23 13:27:43 19949 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2024-08-23 13:27:43 19949 [Note] Binlog end
2024-08-23 13:27:43 19949 [Note] InnoDB: FTS optimize thread exiting.
2024-08-23 13:27:43 19949 [Note] InnoDB: Starting shutdown...
2024-08-23 13:27:45 19949 [Note] InnoDB: Shutdown completed; log sequence number 1625987
...
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.Also, the account for the anonymous user has been removed.In addition, you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the test database.
This is strongly recommended for production servers.See the manual for more instructions.Please report any problems at http://bugs.mysql.com/The latest information about MySQL is available on the web athttp://www.mysql.comSupport MySQL by buying support/licenses at http://shop.mysql.comNew default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings验证    : MySQL-server-5.6.47-1.el7.x86_64                                                                                                             1/1已安装:MySQL-server-5.6.47-1.el7.x86_64完毕!

5.查看临时密码并使用该密码登录

[root@localhost localrepo]# cat /root/.mysql_secret
# The random password set for the root user at Fri Aug 23 13:27:41 2024 (local time): DY3Hus8E7ntGHzPY[root@localhost localrepo]# mysql -uroot -p"DY3Hus8E7ntGHzPY"
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 2
Server version: 5.6.47Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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 localrepo]# mysqladmin -uroot -p"DY3Hus8E7ntGHzPY" password "123456"

6.使用新密码登录

[root@localhost localrepo]# mysql -uroot -p123456
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 9
Server version: 5.6.47 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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> exit
Bye

注意: 上述方法却不能实现mysql -uroot -h IP地址 -p123456登录,提示没有权限

7.赋权

[root@localhost localrepo]# mysql -uroot -p123456
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 11
Server version: 5.6.47 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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> create user "root"@"%" identified by "123456";
Query OK, 0 rows affected (0.00 sec)mysql> grant all on *.* to "root"@"%";
Query OK, 0 rows affected (0.00 sec)mysql> exit
Bye

8.登录时加上ip再试试

[root@localhost localrepo]# mysql -uroot -h192.168.137.102 -p123456
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 12
Server version: 5.6.47 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.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>

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 创意无限,尽在掌握:热门视频剪辑软件一览
  • TiDB-从0到1-TiCDC数据同步工具
  • RabbitMQ中如何通过死信交换机实现延时队列
  • C# 数组,List,Stack,Dictionary,Queue,LinkedList 如何选择
  • 基于YOLOv8的高效滑动验证码滑块缺口检测模型研究与应用
  • 洛谷P9235 [蓝桥杯 2023 省 A] 网络稳定性
  • 在Kibana中查询使用条件ES索引数据
  • 在Windows下安装设置VirtualBox
  • Vue3自定义hooks
  • C++ 内存布局 - Part4: 多继承与this指针调整
  • Deep-Live-Cam启动
  • Flink 流转表,表转流,watermark设置
  • pytest参数化多种用法总结
  • Python在QtSide6(PyQt)上加载网页使用OpenCV进行图像处理
  • PyQtGraph库的基本使用
  • 分享的文章《人生如棋》
  • 【vuex入门系列02】mutation接收单个参数和多个参数
  • Babel配置的不完全指南
  • Git同步原始仓库到Fork仓库中
  • Js基础知识(一) - 变量
  • Redash本地开发环境搭建
  • Spring Cloud Alibaba迁移指南(一):一行代码从 Hystrix 迁移到 Sentinel
  • 从伪并行的 Python 多线程说起
  • 来,膜拜下android roadmap,强大的执行力
  • 前端路由实现-history
  • 视频flv转mp4最快的几种方法(就是不用格式工厂)
  • 小程序01:wepy框架整合iview webapp UI
  • ​一、什么是射频识别?二、射频识别系统组成及工作原理三、射频识别系统分类四、RFID与物联网​
  • #LLM入门|Prompt#1.7_文本拓展_Expanding
  • #LLM入门|Prompt#2.3_对查询任务进行分类|意图分析_Classification
  • #NOIP 2014#day.2 T1 无限网络发射器选址
  • #QT 笔记一
  • $.type 怎么精确判断对象类型的 --(源码学习2)
  • (2)STM32单片机上位机
  • (20)docke容器
  • (2020)Java后端开发----(面试题和笔试题)
  • (LeetCode 49)Anagrams
  • (Python第六天)文件处理
  • (附源码)spring boot校园拼车微信小程序 毕业设计 091617
  • (一)使用Mybatis实现在student数据库中插入一个学生信息
  • (原创)Stanford Machine Learning (by Andrew NG) --- (week 9) Anomaly DetectionRecommender Systems...
  • (源码版)2024美国大学生数学建模E题财产保险的可持续模型详解思路+具体代码季节性时序预测SARIMA天气预测建模
  • (轉貼) VS2005 快捷键 (初級) (.NET) (Visual Studio)
  • .【机器学习】隐马尔可夫模型(Hidden Markov Model,HMM)
  • .net core Redis 使用有序集合实现延迟队列
  • .net framwork4.6操作MySQL报错Character set ‘utf8mb3‘ is not supported 解决方法
  • .Net 基于MiniExcel的导入功能接口示例
  • .Net 垃圾回收机制原理(二)
  • .NET 线程 Thread 进程 Process、线程池 pool、Invoke、begininvoke、异步回调
  • .NETCORE 开发登录接口MFA谷歌多因子身份验证
  • .net利用SQLBulkCopy进行数据库之间的大批量数据传递
  • :O)修改linux硬件时间
  • @AutoConfigurationPackage的使用
  • @NotNull、@NotEmpty 和 @NotBlank 区别
  • @RequestParam @RequestBody @PathVariable 等参数绑定注解详解