1)初始化随机密码    mysqld --initialize

[root@host-172-16-61-102 bin]# ./mysqld --initialize

2020-02-15T07:01:38.309015Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2020-02-15T07:01:38.309069Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.

2020-02-15T07:01:38.497402Z 0 [Warning] InnoDB: New log files created, LSN=45790

2020-02-15T07:01:38.541219Z 0 [Warning] InnoDB: Creating foreign key constraint system

tables.

2020-02-15T07:01:38.553509Z 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: 02fb69c1-4fc1-11ea-8b4e-fa163d34f78d.

2020-02-15T07:01:38.556591Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2020-02-15T07:01:38.980429Z 0 [Warning] CA certificate ca.pem is self signed.

2020-02-15T07:01:39.723869Z 1 [Note] A temporary password is generated for root@localhost: +:NoRLu2kwhd

生成的密码是:+:NoRLu2kwhd

以上的指令,默认读取配置文件/etc/my.cnf,需要/etc/my.cnf文件中指定了数据库的地址,并且生成一个root用户的密码,还有如下的参数可以设置

--user=mysql  //生成指定用户的密码

--datadir=/opt/mysql/mysql/data  //指定生成的数据库数据地址

--defaults-file=/opt/mysql/mysql/etc/my.cnf//指定读取的配置文件,取代默认的配置

2)初始化空密码    mysqld --initialize-insecure

启动mysqld服务 ./mysqld --user=root

创建密码

[root@host-172-16-61-102 bin]# mysql -uroot -p

//提示密码输入,直接回车

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.7.28 MySQL xxx

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

//为root创建密码

MySQL [(none)]> set password = password("root");

Query OK, 0 rows affected, 1 warning (0.00 sec)

MySQL [(none)]> quit

注意:执行“mysqld  --initialize”报错了。提示“initialize specified but the data directory has files in it. Aborting”,大意是提示/opt/mysql/mysql/data数据库地址下有文件,导致无法初始化数据库,这个时候,可以进入到该目录,将所有的数据删除,说明之前已经初始化过

mysql5.7.20+初始化_MySQL5.7.28 初始化数据库相关推荐

  1. mysql5.5.20安装_mysql5.5.20安装文档

    1.安装cmake MySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具. 因此,我们首先要在系统中源码编译安装cmake工具. # wget ...

  2. mysql5.5.20安装_mysql5.5.20源码安装

    rpm -qa|grep  bison rpm -qa|grep ncurses-devel yum install bison yum install ncurses-devel.x86_64 从h ...

  3. mysql-5.7.24初始化数据库_MySQL5.7.28 初始化数据库

    1)初始化随机密码    mysqld --initialize [root@host-172-16-61-102 bin]# ./mysqld --initialize 2020-02-15T07: ...

  4. mysql5.7.17初始化_mysql5.7.17初始化求助 - 墨天轮问答

    安装了一个非压缩版本的5.7.17,初始化总是出错,显示:could not open required defaults file C:\Program Files\MySQL\MySQL Serv ...

  5. mysql5.7.20linux安装,linux下 mysql5.7.20安装(精华)

    在linux 系统中mysql配置文件的读取顺序为: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 第一步 创 ...

  6. mysql 5.6.36安装图解_2017年12月聚合文章--实战-Mysql5.6.36脚本编译安装及初始化 | 码友网...

    概述 本文为centos7.3自动化编译安装mysql5.3.6的脚本及后续初始化操作,话不多少,直接上脚本. 安装脚本install.py如下:#coding=utf-8#!/usr/bin/pyt ...

  7. mysql5.7 首次登陆_mysql5.7.20第一次登录失败的快速解决方法

    一,将介绍如何 (1)mysql5.7是有默认密码的 查找默认密码 grep 'temporary password' /var/log/mysqld.log (2)第一次登录 mysql -uroo ...

  8. mysql5.6.20二进制安装

    1把105的/usr/local/mysql拷过去 2. 把105的/etc/my.cnf拷过去 3. mkdir /data/mysql/{data,tmp,binlog,log}-p 4. 初始化 ...

  9. Java类的连接与初始化 (及2013阿里初始化笔试题解析)

    2019独角兽企业重金招聘Python工程师标准>>> Java虚拟机通过装载.连接.初始化来使得一个Java类型可以被Java程序所使用,如下图所示,其中连接过程又分为验证.准备. ...

最新文章

  1. CEikEdWin 类的使用
  2. Rhel6.0升级内核到3.0.4
  3. [原]我装Solaris的艰苦经历
  4. 计算机模拟量与数字量的转换,在S7-1200 CPU中,如何实现模拟量数值与工程量数值之间的转换?...
  5. TP5 急速上手 语法规则
  6. java 内存泄露监控,Linux下实用的JAVA内存泄露监控命令
  7. 万元华为旗舰新机超21万人预约,网友:有钱人真的多!
  8. 三天学会HTML5 ——多媒体元素的使用
  9. Linux内核线程(一)
  10. 简述物联网感知技术_雄芯一号芯片发布 智慧城市物联网感知体系升级换新
  11. 如何选拔人才-人力资源探讨
  12. 【python教程入门学习】Python转义字符及用法
  13. Android之自定义一个可播放某一时间段的音乐播放器
  14. HDUOJ---汉洛塔IX
  15. 适合人工智能AI的编程语言有哪些 哪些语言适用于人工智能 人工智能开发语言排行榜
  16. MATLAB中画折线图:plot函数的简单用法
  17. 【公众号】高级配色“马卡龙调色板”必须码住!
  18. Ghost for Linux 出色的硬盘对拷工具(转)
  19. STDERR: error: unable to open preload file “/etc/sysctl.d/90-omnibus-gitlab-net.core.somaxconn.conf“
  20. [ElasticSearch] 空间搜索 (一)

热门文章

  1. function收集
  2. 大商超的2020:转型、收紧、试新
  3. InMobi收购美国Sprint旗下数据和广告公司Pinsight Media
  4. mysql o转数字排序_mysql学习,字符串转成数字并比较排序
  5. windows php cli 后台运行_【续】windows环境redis未授权利用方式梳理
  6. oracle v$sql last_load_time,Oracle 等待事件V$视图
  7. phpstudy如何升级php,phpstudy如何升级phpmyadmin?
  8. Python基础教程:正则表达式-匹配多个字符
  9. Python69个内置函数分类总结
  10. python中的作用域以及内置函数globals()-全局变量、locals()-局部变量