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

mysql 5.7.12----bin/mysqld --initialize --user=mysql出错

我最近在安装mysql 5.7.12,本来之前安装mysql 5.7.11时用命令

bin/mysqld --initialize --user=mysql

可以很好的初始化,但是用在5.7.12版本居然报错

[root@centos mysql-5.7.12]# bin/mysqld --initialize --user=mysql
2016-04-28T09:50:25.142068Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-28T09:50:25.142323Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2016-04-28T09:50:25.144865Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2016-04-28T09:50:25.144934Z 0 [ERROR] Aborting

后来发现centos自带的/etc/my.cnf和/etc/mysql没有删掉,后来删掉这两个文件之后在此使用这个命令

仍然报错

mysqld: Can't create directory '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)
2016-04-28T09:53:24.465575Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2016-04-28T09:53:24.467928Z 0 [ERROR] Aborting

后来在网上一查发现使用mysqld命令时要初始化

应该在mysql祝文件夹下创建data文件,但是记得在5.7.11版本里面的data文件是自动生成的

mkdir data

然后执行下面一句

bin/mysqld --user=mysql --basedir=/usr/local/mysql-5.7.12 --datadir=/usr/local/mysql-5.7.12/data/  --initialize

2016-04-28T10:01:07.730549Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-28T10:01:08.194212Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-04-28T10:01:08.725913Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-04-28T10:01:08.810579Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 213135a4-0d28-11e6-b869-000c299613e3.
2016-04-28T10:01:08.816207Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-04-28T10:01:08.819712Z 1 [Note] A temporary password is generated for root@localhost: %?kTFF<e8XXL

这算是成功了把,给出了初始密码,接下来把support-files/my-default.cnf复制到/etc/下,并配置一下

就可以了!

相关文章:

  • javascript获取当前的时间戳
  • java使用Executor(执行器)管理线程
  • WEB和APP谁是互联网未来
  • jvm GC日志解读
  • GCC中-fpic解惑(转载)
  • iOS开发Swift篇—(十)方法
  • 数据库优化和SQL操作的相关题目
  • TNF诱导的关节破坏由IL-1介导
  • Boost中的一些实用技术
  • uWSGI参考资料(1.0版本的配置选项列表)
  • 数据产品设计专题(2)-数据产品设计方法论
  • 某些书籍翻译的太屎了,误导人!
  • js
  • 服务模拟-ServiceMock
  • 超链接点击一次就失效不能再点击
  • 【Leetcode】101. 对称二叉树
  • python3.6+scrapy+mysql 爬虫实战
  • markdown编辑器简评
  • spring boot 整合mybatis 无法输出sql的问题
  • Spring Boot快速入门(一):Hello Spring Boot
  • Spring-boot 启动时碰到的错误
  • Zepto.js源码学习之二
  • 程序员该如何有效的找工作?
  • 腾讯大梁:DevOps最后一棒,有效构建海量运营的持续反馈能力
  • 腾讯优测优分享 | Android碎片化问题小结——关于闪光灯的那些事儿
  • 微信开源mars源码分析1—上层samples分析
  • 智能网联汽车信息安全
  • 策略 : 一文教你成为人工智能(AI)领域专家
  • # C++之functional库用法整理
  • # 安徽锐锋科技IDMS系统简介
  • #、%和$符号在OGNL表达式中经常出现
  • #QT(智能家居界面-界面切换)
  • #我与Java虚拟机的故事#连载04:一本让自己没面子的书
  • #周末课堂# 【Linux + JVM + Mysql高级性能优化班】(火热报名中~~~)
  • $ git push -u origin master 推送到远程库出错
  • $Django python中使用redis, django中使用(封装了),redis开启事务(管道)
  • (06)金属布线——为半导体注入生命的连接
  • (Redis使用系列) Springboot 使用redis实现接口Api限流 十
  • (安全基本功)磁盘MBR,分区表,活动分区,引导扇区。。。详解与区别
  • (笔试题)合法字符串
  • (附源码)springboot宠物管理系统 毕业设计 121654
  • (九十四)函数和二维数组
  • (十六)一篇文章学会Java的常用API
  • (学习日记)2024.01.19
  • (转)ABI是什么
  • (转)ORM
  • (转贴)用VML开发工作流设计器 UCML.NET工作流管理系统
  • .bat文件调用java类的main方法
  • .NET : 在VS2008中计算代码度量值
  • .NET Core 通过 Ef Core 操作 Mysql
  • [ai笔记9] openAI Sora技术文档引用文献汇总
  • [ARM]ldr 和 adr 伪指令的区别
  • [C++]C++基础知识概述
  • [CF407E]k-d-sequence
  • [C语言]——C语言常见概念(1)