1. [root@localhost ~]# yum -y install community-mysql-server #安装数据库
  2.  
  3. 已加载插件:langpacks, refresh-packagekit
  4. google-chrome /
  5. 正在解决依赖关系
  6. There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
  7. --> 正在检查事务
  8. ---> 软件包 community-mysql-server.x86_64.0.5.5.35-.fc20 将被 安装
  9. --> 正在处理依赖关系 community-mysql-common(x86-) = 5.5.-.fc20,它被软件包 community-mysql-server-5.5.-.fc20.x86_64 需要
  10. --> 正在处理依赖关系 mysql(x86-),它被软件包 community-mysql-server-5.5.-.fc20.x86_64 需要
  11. --> 正在检查事务
  12. ---> 软件包 community-mysql.x86_64.0.5.5.35-.fc20 将被 安装
  13. ---> 软件包 community-mysql-common.x86_64.0.5.5.35-.fc20 将被 安装
  14. --> 解决依赖关系完成
  15.  
  16. 依赖关系解决
  17.  
  18. ================================================================================
  19. Package 架构 版本 大小
  20. ================================================================================
  21. 正在安装:
  22. community-mysql-server x86_64 5.5.-.fc20 updates 8.8 M
  23. 为依赖而安装:
  24. community-mysql x86_64 5.5.-.fc20 updates 4.9 M
  25. community-mysql-common x86_64 5.5.-.fc20 updates k
  26.  
  27. 事务概要
  28. ================================================================================
  29. 安装 软件包 (+ 依赖软件包)
  30.  
  31. 总下载量: M
  32. 安装大小: M
  33. Downloading packages:
  34. (/): community-mysql-5.5.-.fc20.x86_64.rpm | 4.9 MB :
  35. (/): community-mysql-common-5.5.-.fc20.x86_64.rpm | kB :
  36. (/): community-mysql-server-5.5.-.fc20.x86_64.rpm | 8.8 MB :
  37. --------------------------------------------------------------------------------
  38. 总计 1.4 MB/s | MB :
  39. Running transaction check
  40. Running transaction test
  41. Transaction test succeeded
  42. Running transaction
  43. 正在安装 : community-mysql-common-5.5.-.fc20.x86_64 /
  44. 正在安装 : community-mysql-5.5.-.fc20.x86_64 /
  45. 正在安装 : community-mysql-server-5.5.-.fc20.x86_64 /
  46. 验证中 : community-mysql-5.5.-.fc20.x86_64 /
  47. 验证中 : community-mysql-server-5.5.-.fc20.x86_64 /
  48. 验证中 : community-mysql-common-5.5.-.fc20.x86_64 /
  49.  
  50. 已安装:
  51. community-mysql-server.x86_64 :5.5.-.fc20
  52.  
  53. 作为依赖被安装:
  54. community-mysql.x86_64 :5.5.-.fc20
  55. community-mysql-common.x86_64 :5.5.-.fc20
  56.  
  57. 完毕!
  58. [root@localhost ~]# systemctl start mysqld.service
  59. [root@localhost ~]# systemctl enable mysqld.service
  60. ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
  61. [root@localhost ~]# mysql -u root #以root登陆数据库
  62. Welcome to the MySQL monitor. Commands end with ; or \g.
  63. Your MySQL connection id is
  64. Server version: 5.5. MySQL Community Server (GPL)
  65.  
  66. Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
  67.  
  68. Oracle is a registered trademark of Oracle Corporation and/or its
  69. affiliates. Other names may be trademarks of their respective
  70. owners.
  71.  
  72. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  73.  
  74. mysql> select user, host, password from mysql.user; #user列表
  75. +------+-----------+----------+
  76. | user | host | password |
  77. +------+-----------+----------+
  78. | root | localhost | |
  79. | root | rachel | |
  80. | root | 127.0.0.1 | |
  81. | root | :: | |
  82. | | localhost | |
  83. | | rachel | |
  84. +------+-----------+----------+
  85. rows in set (0.00 sec)
  86.  
  87. mysql> delete from mysql.user where user=''; #删除空user
  88. Query OK, rows affected (0.00 sec)
  89.  
  90. mysql> delete from mysql.user where user='root' and host='::1'; #删除IPv6用户(如果不用的话)
  91. Query OK, row affected (0.00 sec)
  92.  
  93. mysql> select user, host, password from mysql.user;
  94. +------+-----------+----------+
  95. | user | host | password |
  96. +------+-----------+----------+
  97. | root | localhost | |
  98. | root | rachel | |
  99. | root | 127.0.0.1 | |
  100. +------+-----------+----------+
  101. rows in set (0.00 sec)
  102.  
  103. # 设定密码
  104. mysql> set password for root@localhost=password('XXXXXX');
  105. Query OK, rows affected (0.00 sec)
  106.  
  107. mysql> set password for root@rachel=password('XXXXXX');
  108. Query OK, rows affected (0.00 sec)
  109.  
  110. mysql> set password for root@'127.0.0.1'=password('XXXXXXX');
  111. Query OK, rows affected (0.00 sec)
  112.  
  113. #再次列密码
  114. mysql> select user, host, password from mysql.user;
  115. +------+-----------+-------------------------------------------+
  116. | user | host | password |
  117. +------+-----------+-------------------------------------------+
  118. | root | localhost | *C7E2F6338326EDC0AXXXXXXXXXXXXXXXXXXXXXXX |
  119. | root | rachel | *C7E2F6338326EDC0AXXXXXXXXXXXXXXXXXXXXXXX |
  120. | root | 127.0.0.1 | *C7E2F6338326EDC0AXXXXXXXXXXXXXXXXXXXXXXX |
  121. +------+-----------+-------------------------------------------+
  122. rows in set (0.00 sec)
  123.  
  124. mysql> exit
  125. Bye
  126. [root@localhost ~]# mysql -u root -p #再次登录
  127. Enter password: #输入刚才的密码
  128. Welcome to the MySQL monitor. Commands end with ; or \g.
  129. Your MySQL connection id is
  130. Server version: 5.5. MySQL Community Server (GPL)
  131.  
  132. Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
  133.  
  134. Oracle is a registered trademark of Oracle Corporation and/or its
  135. affiliates. Other names may be trademarks of their respective
  136. owners.
  137.  
  138. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  139.  
  140. mysql> exit
  141. Bye
  142. [root@localhost ~]#

在Fedora 20 上安装Mysql并初始化root密码的更多相关文章

  1. 阿里云ecs Linux下安装MySQL后设置root密码 【转】

    方法一:最简单的方法,也是安装完mysql后,系统提示的方法.使用mysqladmin来完成.shell> mysqladmin -u root password "newpwd&qu ...

  2. MacOs安装mysql与修改root密码

    1.下载安装包 http://www.mysql.com/downloads/ 找到如下内容下载 mysql-5.7.21-1-macos10.13-x86_64.dmg下载地址是 https://c ...

  3. 记录下 rhel 7 安装MySQL 并重置root密码

    注意官方是很不提倡用root的. 下载并安装MySQL 最新的rpm地址 https://dev.mysql.com/downloads/repo/yum/ #wget https://repo.my ...

  4. Ubuntu 20.04上安装MySQL教程,ubuntu安装mysql

    在Ubuntu 20.04上安装MySQL教程 先决条件 确保您以具有sudo特权的用户身份登录. 在Ubuntu上安装MySQL 在撰写本文时,Ubuntu存储库中可用的MySQL的最新版本是MyS ...

  5. 在Windows上安装MySQL(免安装ZIP版)

    在 Windows 上安装MySQL(免安装ZIP版) 因为一些原因,重新安装了MySQL数据库,重装时习惯性使用最新版下载 此过程中发现MySQL 5.7.12 和MySQL 5.6的安装有些区别: ...

  6. 记录CentOS 7.4 上安装MySQL&MariaDB&Redis&Mongodb

    记录CentOS 7.4 上安装MySQL&MariaDB&Redis&Mongodb 前段时间我个人Google服务器意外不能用,并且我犯了一件很低级的错误,直接在gcp讲服 ...

  7. Windows 上安装 MySQL(8.0.11)

    1.接下来我们需要配置下 MySQL 的配置文件 打开刚刚解压的文件夹 C:\web\mysql-8.0.11 ,在该文件夹下创建 my.ini 配置文件,编辑 my.ini 配置以下基本信息: [m ...

  8. 在Linux机器上安装MySQL

    在Linux机器上安装MySQL,仔细认真些就没有问题. CentOS 7下MySQL 5.7安装.配置与应用_数据库技术_Linux公社-Linux系统门户网站 搞不定的话,直接删掉这个MySQL, ...

  9. Ubuntu 12.04上安装MySQL并运行

    Ubuntu 12.04上安装MySQL并运行 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 安装MySQL数据库 sudo apt-get upda ...

随机推荐

  1. Java-IO之DeflaterOutputStream和InflaterOutputStream

    此类为使用 "deflate" 压缩格式压缩数据实现输出流过滤器 example import java.io.File; import java.io.FileInputStre ...

  2. map遍历方法

    java中遍历MAP的几种方法 Java代码 Map<String,String> map=new HashMap<String,String>();    map.put(& ...

  3. 自然语言18.1_Named Entity Recognition with NLTK

    QQ:231469242 欢迎nltk爱好者交流 https://www.pythonprogramming.net/named-entity-recognition-nltk-tutorial/?c ...

  4. c++模板类

    c++模板类 理解编译器的编译模板过程 如何组织编写模板程序 前言常遇到询问使用模板到底是否容易的问题,我的回答是:“模板的使用是容易的,但组织编写却不容易”.看看我们几乎每天都能遇到的模板类吧,如S ...

  5. GLSL Interface Block参考

    http://www.opengl.org/wiki/Interface_Block_(GLSL) http://stackoverflow.com/questions/9916103/opengl- ...

  6. VM EXSI安装使用

    1.下载VM ESXI:http://lookdfw.blog.163.com/blog/static/5824974220139295524473/ 2.安装VM ESXI: 参考网址:http:/ ...

  7. xcopy

    xcopy "$(ProjectDir)Admin"  "$(SolutionDir)模块\CanDoo.Admin.WebHost\Admin"  /e/h ...

  8. owin

    app.Properties["Hello"] = System.DateTime.Now; app.Run(async context => await context.R ...

  9. tmpfs——Linux的一种虚拟内存文件系统

    虚拟内核文件系统(VirtualKernel File Systems),是指那些是由内核产生但不存在于硬盘上(存在于内存中)的文件系统.例如 1.proc proc文件系统为操作系统本身和应用程序之 ...

  10. Java内存区域-- 运行时数据区域

    jvm在执行Java程序时,会把它所管理的内存划分为若干个不同的数据区.这些区域都有各自的用途,以及创建和销毁的时间. 有的区域随着虚拟机进程的启动而存在,有些区域则依赖用户线程的启动和结束而建立和销 ...