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

unknown variable ‘authentication_policy=mysql_native_password‘

unknown variable 'authentication_policy=mysql_native_password'

  • 背景
  • 解决
    • 尝试一
    • 尝试二(解决)
  • 总结

背景

mac上安装多个版本数据库。我是通过dmg安装的,先装的5.7,再装的5.8,然后5.8的能正常用,5.7的启动不起来。报错信息为如下

2023-12-27T11:50:43.479739Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-27T11:50:43.479980Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2023-12-27T11:50:43.480218Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.12) starting as process 90928 ...
2023-12-27T11:50:43.481832Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2023-12-27T11:50:43.483414Z 0 [Warning] You need to use --log-bin to make --binlog-format work.
2023-12-27T11:50:43.486307Z 0 [ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
2023-12-27T11:50:43.486907Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-12-27T11:50:43.486915Z 0 [Note] InnoDB: Uses event mutexes
2023-12-27T11:50:43.486919Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-12-27T11:50:43.486923Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2023-12-27T11:50:43.487938Z 0 [Note] InnoDB: Number of pools: 1
2023-12-27T11:50:43.487999Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-12-27T11:50:43.662577Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-12-27T11:50:43.667975Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-27T11:50:43.682914Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-12-27T11:50:43.688889Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-12-27T11:50:43.689059Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-12-27T11:50:43.692481Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-12-27T11:50:43.692851Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-12-27T11:50:43.692857Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-12-27T11:50:43.693045Z 0 [Note] InnoDB: Waiting for purge to start
2023-12-27T11:50:43.748088Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2527696
2023-12-27T11:50:43.748195Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql-5.7/data/ib_buffer_pool
2023-12-27T11:50:43.748427Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-12-27T11:50:43.748994Z 0 [Note] InnoDB: Buffer pool(s) load completed at 231227 19:50:43
2023-12-27T11:50:43.749371Z 0 [ERROR] unknown variable 'authentication_policy=mysql_native_password'
2023-12-27T11:50:43.749381Z 0 [ERROR] Aborting2023-12-27T11:50:43.749392Z 0 [Note] Binlog end
2023-12-27T11:50:43.749429Z 0 [Note] Shutting down plugin 'ngram'
2023-12-27T11:50:43.749437Z 0 [Note] Shutting down plugin 'partition'
2023-12-27T11:50:43.749443Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2023-12-27T11:50:43.749449Z 0 [Note] Shutting down plugin 'ARCHIVE'
2023-12-27T11:50:43.749454Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2023-12-27T11:50:43.749481Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2023-12-27T11:50:43.749488Z 0 [Note] Shutting down plugin 'MyISAM'
2023-12-27T11:50:43.749499Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2023-12-27T11:50:43.749505Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2023-12-27T11:50:43.749510Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2023-12-27T11:50:43.749515Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2023-12-27T11:50:43.749519Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2023-12-27T11:50:43.749524Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2023-12-27T11:50:43.749529Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2023-12-27T11:50:43.749533Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2023-12-27T11:50:43.749538Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2023-12-27T11:50:43.749544Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2023-12-27T11:50:43.749548Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2023-12-27T11:50:43.749554Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2023-12-27T11:50:43.749559Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2023-12-27T11:50:43.749565Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2023-12-27T11:50:43.749571Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2023-12-27T11:50:43.749577Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2023-12-27T11:50:43.749581Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2023-12-27T11:50:43.749585Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2023-12-27T11:50:43.749589Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2023-12-27T11:50:43.749592Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2023-12-27T11:50:43.749596Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2023-12-27T11:50:43.749599Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2023-12-27T11:50:43.749603Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2023-12-27T11:50:43.749607Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2023-12-27T11:50:43.749610Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2023-12-27T11:50:43.749614Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2023-12-27T11:50:43.749617Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2023-12-27T11:50:43.749621Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2023-12-27T11:50:43.749625Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2023-12-27T11:50:43.749628Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2023-12-27T11:50:43.749632Z 0 [Note] Shutting down plugin 'InnoDB'
2023-12-27T11:50:43.749719Z 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-27T11:50:43.749747Z 0 [Note] InnoDB: Starting shutdown...
2023-12-27T11:50:43.855004Z 0 [Note] InnoDB: Dumping buffer pool(s) to /usr/local/mysql-5.7/data/ib_buffer_pool
2023-12-27T11:50:43.856040Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 231227 19:50:43
2023-12-27T11:50:45.229428Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2527715
2023-12-27T11:50:45.230046Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-12-27T11:50:45.230082Z 0 [Note] Shutting down plugin 'MEMORY'
2023-12-27T11:50:45.230103Z 0 [Note] Shutting down plugin 'CSV'
2023-12-27T11:50:45.230116Z 0 [Note] Shutting down plugin 'sha256_password'
2023-12-27T11:50:45.230127Z 0 [Note] Shutting down plugin 'mysql_native_password'
2023-12-27T11:50:45.230136Z 0 [Note] Shutting down plugin 'keyring_file'
2023-12-27T11:50:45.233646Z 0 [Note] Shutting down plugin 'binlog'
2023-12-27T11:50:45.233996Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

解决

报错信息主要有两个:

  • keyring_file
  • authentication_policy=mysql_native_password
    第一个感觉不是很关键,因为报错了程序还是继续往下在走。第二个的话,查了一下说是配置错误,这个配置是8.0的,5.7的识别不了。

尝试一

既然识别不了,把配置改了不就行了。但是又有一个问题,用的是默认配置,只能新建配置进行覆写。

在这里插入图片描述

这里可以看到,也有keyring的路径,这次我没处理它,但是在对应路径下创建了文件。然后手动创建了启动配置,然后设置了对应的目录,这里注意需要apply一下。

但是呢,再次重启还是失败,keyring的问题没有修复,指定的配置文件也没有生效。。服务一直处于运行中 》 暂停 》运行中的死循环。突发奇想,ps了一下,发现有惊喜。。。

在这里插入图片描述

理解没啥问题,配置实际也读取到了,但是最后它又加了奇奇怪怪的一些配置,然后其中就有导致我们出错的命令authentication_policy=mysql_native_password。那么,问题来了,这东西是哪里来的呢?

尝试二(解决)

查了一些资料,说是一般在/Library/LaunchDaemons目录下,我进去看了一眼,过滤了一下,发现的确有它。

在这里插入图片描述

看了一下文件内容,找到了!

在这里插入图片描述

后面就是把那一行注了,然后把之前指定的配置文件和keyring配置关了

在这里插入图片描述

再次尝试重启,启动成功了!

2023-12-27T11:56:09.333257Z 0 [ERROR] kevent failed with errno= 9,exiting timer notifier thread.
2023-12-27T11:56:09.610993Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-27T11:56:09.611244Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2023-12-27T11:56:09.611509Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.12) starting as process 92465 ...
2023-12-27T11:56:09.613531Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2023-12-27T11:56:09.615096Z 0 [Warning] You need to use --log-bin to make --binlog-format work.
2023-12-27T11:56:09.616205Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-12-27T11:56:09.616218Z 0 [Note] InnoDB: Uses event mutexes
2023-12-27T11:56:09.616223Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-12-27T11:56:09.616227Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2023-12-27T11:56:09.617303Z 0 [Note] InnoDB: Number of pools: 1
2023-12-27T11:56:09.617372Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-12-27T11:56:09.809280Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-12-27T11:56:09.815378Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-27T11:56:09.830516Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-12-27T11:56:09.837315Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-12-27T11:56:09.837470Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-12-27T11:56:09.841482Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-12-27T11:56:09.841870Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-12-27T11:56:09.841876Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-12-27T11:56:09.842056Z 0 [Note] InnoDB: Waiting for purge to start
2023-12-27T11:56:09.897098Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2528355
2023-12-27T11:56:09.897213Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql-5.7/data/ib_buffer_pool
2023-12-27T11:56:09.897499Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-12-27T11:56:09.897755Z 0 [Note] InnoDB: Buffer pool(s) load completed at 231227 19:56:09
2023-12-27T11:56:09.902571Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2023-12-27T11:56:09.902581Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2023-12-27T11:56:09.902757Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2023-12-27T11:56:09.902809Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2023-12-27T11:56:09.934502Z 0 [Note] Event Scheduler: Loaded 0 events
2023-12-27T11:56:09.934584Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.12'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server (GPL)

总结

碰到问题还是看看日志吧,一般都会记录原因。一开始我先是以为版本问题,换了一个5.7的版本,试了一下没用。然后百度、google查资料,也没找到线索。。最后还是得自己分析。。。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 图像分割实战-系列教程7:unet医学细胞分割实战5(医学数据集、图像分割、语义分割、unet网络、代码逐行解读)
  • LeetCode 1758. 生成交替二进制字符串的最少操作数【字符串,模拟】1353
  • 2024年01月数据库流行度最新排名
  • 开源掌机是什么?
  • FA模板制作
  • R_handbook_统计分析
  • 数据结构:队列(链表和数组模拟实现)
  • 大数据机器学习GAN:生成对抗网络GAN全维度介绍与实战
  • 系统学习Python——装饰器:函数装饰器-[对方法进行装饰:基础知识]
  • 基础算法-归并排序
  • 20231228在Firefly的AIO-3399J开发板的Android11使用Firefly的DTS配置单前后摄像头ov13850
  • Pandas的apply方法的应用练习
  • 2023-12-12LeetCode每日一题(下一个更大元素 IV)
  • SDG大数据平台简介
  • [ 云计算 | AWS ] 对比分析:Amazon SNS 与 SQS 消息服务的异同与选择
  • 【399天】跃迁之路——程序员高效学习方法论探索系列(实验阶段156-2018.03.11)...
  • css选择器
  • idea + plantuml 画流程图
  • JS创建对象模式及其对象原型链探究(一):Object模式
  • mysql 5.6 原生Online DDL解析
  • nginx(二):进阶配置介绍--rewrite用法,压缩,https虚拟主机等
  • Swift 中的尾递归和蹦床
  • thinkphp5.1 easywechat4 微信第三方开放平台
  • 从零开始的无人驾驶 1
  • 携程小程序初体验
  • 一些基于React、Vue、Node.js、MongoDB技术栈的实践项目
  • 智能情侣枕Pillow Talk,倾听彼此的心跳
  • ‌移动管家手机智能控制汽车系统
  • ()、[]、{}、(())、[[]]命令替换
  • (02)vite环境变量配置
  • (14)目标检测_SSD训练代码基于pytorch搭建代码
  • (51单片机)第五章-A/D和D/A工作原理-A/D
  • (Arcgis)Python编程批量将HDF5文件转换为TIFF格式并应用地理转换和投影信息
  • (ISPRS,2023)深度语义-视觉对齐用于zero-shot遥感图像场景分类
  • (Qt) 默认QtWidget应用包含什么?
  • (第8天)保姆级 PL/SQL Developer 安装与配置
  • (分类)KNN算法- 参数调优
  • (附源码)ssm捐赠救助系统 毕业设计 060945
  • (附源码)ssm旅游企业财务管理系统 毕业设计 102100
  • (经验分享)作为一名普通本科计算机专业学生,我大学四年到底走了多少弯路
  • (心得)获取一个数二进制序列中所有的偶数位和奇数位, 分别输出二进制序列。
  • ***微信公众号支付+微信H5支付+微信扫码支付+小程序支付+APP微信支付解决方案总结...
  • **PyTorch月学习计划 - 第一周;第6-7天: 自动梯度(Autograd)**
  • .helper勒索病毒的最新威胁:如何恢复您的数据?
  • .htaccess配置重写url引擎
  • .mkp勒索病毒解密方法|勒索病毒解决|勒索病毒恢复|数据库修复
  • .net core 6 集成和使用 mongodb
  • .net core IResultFilter 的 OnResultExecuted和OnResultExecuting的区别
  • .net core开源商城系统源码,支持可视化布局小程序
  • .Net MVC4 上传大文件,并保存表单
  • .NET MVC第三章、三种传值方式
  • .NET 使用 ILRepack 合并多个程序集(替代 ILMerge),避免引入额外的依赖
  • .Net 中Partitioner static与dynamic的性能对比
  • .net(C#)中String.Format如何使用
  • .NET/C# 中设置当发生某个特定异常时进入断点(不借助 Visual Studio 的纯代码实现)