之前虽然也安装过多次mysql,但每次都会遇到各种小问题,这次记录下来,以备后查。

首先是下载与安装

  1. # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
  2. # rpm -ivh mysql-community-release-el7-.noarch.rpm
  3. # yum install mysql-community-server

安装过程中间会出现选择y/n的,直接输入y即可,如下:

  1. [root@APP1 /]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
  2. ---- ::-- http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
  3. Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
  4. Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:... connected.
  5. HTTP request sent, awaiting response... Moved Permanently
  6. Location: https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm [following]
  7. ---- ::-- https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
  8. Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:... connected.
  9. HTTP request sent, awaiting response... Found
  10. Location: https://repo.mysql.com//mysql-community-release-el7-5.noarch.rpm [following]
  11. ---- ::-- https://repo.mysql.com//mysql-community-release-el7-5.noarch.rpm
  12. Resolving repo.mysql.com (repo.mysql.com)... 23.219.33.198
  13. Connecting to repo.mysql.com (repo.mysql.com)|23.219.33.198|:... connected.
  14. HTTP request sent, awaiting response... OK
  15. Length: (.0K) [application/x-redhat-package-manager]
  16. Saving to: ysql-community-release-el7-.noarch.rpm?
  17.  
  18. %[====================================================================================================>] , --.-K/s in 0s
  19.  
  20. -- :: ( MB/s) - ysql-community-release-el7-.noarch.rpm?saved [/]
  21.  
  22. [root@APP1 /]# rpm -ivh mysql-community-release-el7-.noarch.rpm

  23. Preparing... ################################# [%]

  24. Updating / installing...

  25. :mysql-community-release-el7- ################################# [%]

  26. [root@APP1 /]# yum install mysql-community-server

  27. Loaded plugins: fastestmirror, langpacks

  28. base | 3.6 kB ::

  29. extras | 3.4 kB ::

  30. mysql-connectors-community | 2.5 kB ::

  31. mysql-tools-community | 2.5 kB ::

  32. mysql56-community | 2.5 kB ::

  33. updates | 3.4 kB ::

  34. (/): base//x86_64/group_gz | kB ::

  35. (/): extras//x86_64/primary_db | kB ::

  36. (/): mysql-connectors-community/x86_64/primary_db | kB ::

  37. (/): mysql-tools-community/x86_64/primary_db | kB ::

  38. (/): updates//x86_64/primary_db | 2.9 MB ::

  39. (/): base//x86_64/primary_db | 5.7 MB ::

  40. (/): mysql56-community/x86_64/primary_db | kB ::

  41. Determining fastest mirrors

  42. base: mirrors.btte.net

  43. extras: mirrors..com

  44. * updates: mirrors.sohu.com

  45. Resolving Dependencies

  46. --> Running transaction check

  47. ---> Package mysql-community-server.x86_64 :5.6.-.el7 will be installed

  48. --> Processing Dependency: mysql-community-common(x86-) = 5.6.-.el7 for package: mysql-community-server-5.6.-.el7.x86_64

  49. --> Processing Dependency: mysql-community-client(x86-) >= 5.6. for package: mysql-community-server-5.6.-.el7.x86_64

  50. --> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.-.el7.x86_64

  51. --> Running transaction check

  52. ---> Package mysql-community-client.x86_64 :5.6.-.el7 will be installed

  53. --> Processing Dependency: mysql-community-libs(x86-) >= 5.6. for package: mysql-community-client-5.6.-.el7.x86_64

  54. ---> Package mysql-community-common.x86_64 :5.6.-.el7 will be installed

  55. ---> Package perl-DBI.x86_64 :1.627-.el7 will be installed

  56. --> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-.el7.x86_64

  57. --> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-.el7.x86_64

  58. --> Running transaction check

  59. ---> Package mariadb-libs.x86_64 :5.5.-.el7 will be obsoleted

  60. ---> Package mysql-community-libs.x86_64 :5.6.-.el7 will be obsoleting

  61. ---> Package perl-PlRPC.noarch :0.2020-.el7 will be installed

  62. --> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-.el7.noarch

  63. --> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-.el7.noarch

  64. --> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-.el7.noarch

  65. --> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-.el7.noarch

  66. --> Running transaction check

  67. ---> Package perl-IO-Compress.noarch :2.061-.el7 will be installed

  68. --> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-.el7.noarch

  69. --> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-.el7.noarch

  70. ---> Package perl-Net-Daemon.noarch :0.48-.el7 will be installed

  71. --> Running transaction check

  72. ---> Package perl-Compress-Raw-Bzip2.x86_64 :2.061-.el7 will be installed

  73. ---> Package perl-Compress-Raw-Zlib.x86_64 :2.061-.el7 will be installed

  74. --> Finished Dependency Resolution
  75.  
  76. Dependencies Resolved
  77.  
  78. Package Arch Version Repository Size



  79. Installing:

  80. mysql-community-libs x86_64 5.6.-.el7 mysql56-community 2.0 M

  81. replacing mariadb-libs.x86_64 :5.5.-.el7

  82. mysql-community-server x86_64 5.6.-.el7 mysql56-community M

  83. Installing for dependencies:

  84. mysql-community-client x86_64 5.6.-.el7 mysql56-community M

  85. mysql-community-common x86_64 5.6.-.el7 mysql56-community k

  86. perl-Compress-Raw-Bzip2 x86_64 2.061-.el7 base k

  87. perl-Compress-Raw-Zlib x86_64 :2.061-.el7 base k

  88. perl-DBI x86_64 1.627-.el7 base k

  89. perl-IO-Compress noarch 2.061-.el7 base k

  90. perl-Net-Daemon noarch 0.48-.el7 base k

  91. perl-PlRPC noarch 0.2020-.el7 base k
  92.  
  93. Transaction Summary

  94. ==============================================================================================================================================

  95. Install Packages (+ Dependent packages)
  96.  
  97. Total download size: M

  98. Is this ok [y/d/N]: y

  99. Downloading packages:

  100. warning: /var/cache/yum/x86_64//mysql56-community/packages/mysql-community-common-5.6.-.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

  101. Public key for mysql-community-common-5.6.-.el7.x86_64.rpm is not installed

  102. (/): mysql-community-common-5.6.-.el7.x86_64.rpm | kB ::

  103. mysql-community-libs-5.6.-. FAILED ] kB/s | MB :: ETA

  104. http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-libs-5.6.38-2.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-libs-5.6.38-2.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')

  105. Trying other mirror.

  106. (/): perl-DBI-1.627-.el7.x86_64.rpm | kB ::

  107. (/): perl-IO-Compress-2.061-.el7.noarch.rpm | kB ::

  108. (/): perl-Net-Daemon-0.48-.el7.noarch.rpm | kB ::

  109. (/): perl-PlRPC-0.2020-.el7.noarch.rpm | kB ::

  110. (/): perl-Compress-Raw-Bzip2-2.061-.el7.x86_64.rpm | kB ::

  111. (/): perl-Compress-Raw-Zlib-2.061-.el7.x86_64.rpm | kB ::

  112. mysql-community-server-5.6.- FAILED ] kB/s | MB :: ETA

  113. http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-server-5.6.38-2.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-server-5.6.38-2.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')

  114. Trying other mirror.

  115. (/): mysql-community-client-5.6.-.el7.x86_64.rpm | MB ::

  116. (/): mysql-community-libs-5.6.-.el7.x86_64.rpm | 2.0 MB ::

  117. (/): mysql-community-server-5.6.-.el7.x86_64.rpm | MB ::

  118. ----------------------------------------------------------------------------------------------------------------------------------------------

  119. Total kB/s | MB ::

  120. Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

  121. Importing GPG key 0x5072E1F5:

  122. Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"

  123. Fingerprint: a4a9 76fc bd3c 70c8 8c71 8d3b e1f5

  124. Package : mysql-community-release-el7-.noarch (installed)

  125. From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

  126. Is this ok [y/N]: y

  127. Running transaction check

  128. Running transaction test

  129. Transaction test succeeded

  130. Running transaction

  131. Warning: RPMDB altered outside of yum.

  132. Installing : mysql-community-common-5.6.-.el7.x86_64 /

  133. Installing : mysql-community-libs-5.6.-.el7.x86_64 /

  134. Installing : mysql-community-client-5.6.-.el7.x86_64 /

  135. Installing : :perl-Compress-Raw-Zlib-2.061-.el7.x86_64 /

  136. Installing : perl-Net-Daemon-0.48-.el7.noarch /

  137. Installing : perl-Compress-Raw-Bzip2-2.061-.el7.x86_64 /

  138. Installing : perl-IO-Compress-2.061-.el7.noarch /

  139. Installing : perl-PlRPC-0.2020-.el7.noarch /

  140. Installing : perl-DBI-1.627-.el7.x86_64 /

  141. Installing : mysql-community-server-5.6.-.el7.x86_64 /

  142. Erasing : :mariadb-libs-5.5.-.el7.x86_64 /

  143. Verifying : perl-Compress-Raw-Bzip2-2.061-.el7.x86_64 /

  144. Verifying : perl-Net-Daemon-0.48-.el7.noarch /

  145. Verifying : perl-PlRPC-0.2020-.el7.noarch /

  146. Verifying : mysql-community-client-5.6.-.el7.x86_64 /

  147. Verifying : mysql-community-server-5.6.-.el7.x86_64 /

  148. Verifying : :perl-Compress-Raw-Zlib-2.061-.el7.x86_64 /

  149. Verifying : mysql-community-common-5.6.-.el7.x86_64 /

  150. Verifying : mysql-community-libs-5.6.-.el7.x86_64 /

  151. Verifying : perl-DBI-1.627-.el7.x86_64 /

  152. Verifying : perl-IO-Compress-2.061-.el7.noarch /

  153. Verifying : :mariadb-libs-5.5.-.el7.x86_64 /
  154.  
  155. Installed:

  156. mysql-community-libs.x86_64 :5.6.-.el7 mysql-community-server.x86_64 :5.6.-.el7
  157.  
  158. Dependency Installed:

  159. mysql-community-client.x86_64 :5.6.-.el7 mysql-community-common.x86_64 :5.6.-.el7 perl-Compress-Raw-Bzip2.x86_64 :2.061-.el7

  160. perl-Compress-Raw-Zlib.x86_64 :2.061-.el7 perl-DBI.x86_64 :1.627-.el7 perl-IO-Compress.noarch :2.061-.el7

  161. perl-Net-Daemon.noarch :0.48-.el7 perl-PlRPC.noarch :0.2020-.el7
  162.  
  163. Replaced:

  164. mariadb-libs.x86_64 :5.5.-.el7
  165.  
  166. Complete!

  167. You have new mail in /var/spool/mail/root

安装成功后重启mysql服务

  1. # service mysqld restart

初次安装mysql,root账户没有密码。

  1. # mysql -u root
  2. Welcome to the MySQL monitor. Commands end with ; or \g.
  3. Your MySQL connection id is
  4. Server version: 5.6. MySQL Community Server (GPL)
  5.  
  6. Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
  7.  
  8. Oracle is a registered trademark of Oracle Corporation and/or its

  9. affiliates. Other names may be trademarks of their respective

  10. owners.
  11.  
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  13.  
  14. mysql> show databases;

  15. +--------------------+

  16. | Database |

  17. +--------------------+

  18. | information_schema |

  19. | mysql |

  20. | performance_schema |

  21. +--------------------+

  22. rows in set (0.00 sec)
  23.  
  24. mysql>

设置密码

  1. mysql> set password for 'root'@'localhost'=password('password');
  2. Query OK, rows affected (0.00 sec)
  3.  
  4. mysql> exit

  5. Bye

配置编码格式

  1. mysql> default-character-set =utf8
  2. ->

设置允许远程连接

  1. mysql> grant all privileges on *.* to root@'%'identified by 'password';
  2. Query OK, rows affected (0.00 sec)
  3.  
  4. mysql>

如果允许root账号远程连接要对系统数据库的root账户设置远程访问的密码,与本地的root访问密码并不冲突。

  1. 1 grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; #123456为你需要设置的密码

CentOS7 下的mysql安装与配置的更多相关文章

  1. Centos7 下的SVN安装与配置

    Centos7 下的SVN安装与配置 1.关闭防火墙 临时关闭防火墙 systemctl stop firewalld 永久防火墙开机自关闭 systemctl disable firewalld 临 ...

  2. CentOS7下NFS服务安装及配置固定端口

    CentOS7下NFS服务安装及配置 系统环境:CentOS Linux release 7.4.1708 (Core) 3.10.0-693.el7.x86_64 软件版本:nfs-utils-1. ...

  3. CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin,mysql8.0.1/mysql5.7.22+centos7,windows mysql安装、配置

    介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...

  4. CentOS7下一个mysql安装

    CentOS7安装MySQL --下载mysql http://mirrors.sohu.com/mysql/MySQL-5.6/ http://mirrors.sohu.com/mysql/MySQ ...

  5. centos7下git的安装和配置

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  6. 阿里云Linxu下的Mysql安装与配置

    说明:本文主要详细介绍了关于如何在阿里云ECS服务器上安装并配置Mysql 环境:Centos 7版本,阿里云部署好系统后会默认安装mariadb数据库 1.删除阿里云自带的MariaDB # rpm ...

  7. Centos7下nginx的安装与配置

    说明:软件安装的基础目录路径:/usr/local 所以下载软件的时候切换到此目录下下载直接解压即可 1.安装gcc gcc-c++依赖包 yum install -y gcc gcc-c++ 2.下 ...

  8. Centos下的MySQL安装及配置

    里使用的是VMware虚拟机和Centos7系统 虚拟机安装这里不多讲,网上教程很多了,这里就介绍下虚拟机的网络配置. 虚拟机网络配置 Centos网络连接模式这里设置为桥接模式,不用勾选复制物理网络 ...

  9. centos7下postgresql数据库安装及配置

    1.安装 #yum install -y postgresql-server 2.postgresql数据库初始化 #service postgresql initdb 3.启动postgresql服 ...

随机推荐

  1. 【hihocoder 1564】同步H公司的终端

    [链接]http://hihocoder.com/problemset/problem/1564 [题意] 在这里写题意 [题解] 如下图 (上图中节点旁边的红色数字为它的权值) 从叶子节点开始考虑. ...

  2. 2 Java基础语法(keyword,标识符,凝视,常量,进制转换,变量,数据类型,数据类型转换)

    1:keyword(掌握) (1)被Java语言赋予特定含义的单词 (2)特点: 所有小写. (3)注意事项: A:goto和const作为保留字存在. B:类似于Notepad++这种高级记事本会对 ...

  3. 魅族MX5和努比亚布拉格手机參数对照

    想买个Android手机锁定魅族MX5和努比亚布拉格.两个官网翻来翻去的非常难取舍,自己列了一个表对比了一下參数,本人喜欢薄一点的手机.有feel.參数对比表例如以下: 手机 魅族MX5 努比亚布拉格 ...

  4. MySQL和Python交互

    与Python交互 python3模块名:pymysql conda install pymysql conda install sqlalchemy python2模块名:MySQLdb impor ...

  5. python3 turtle画正方形、矩形、正方体、五角星、奥运五环

    python3 环境 turtle模块 分别画出 正方形.矩形.正方体.五角星.奥运五环 #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:H ...

  6. DB2学习总结(1)——DB2数据库基础入门

    DB2的特性 完全Web使能的:可以利用HTTP来发送询问给服务器. 高度可缩放和可靠:高负荷时可利用多处理器和大内存,可以跨服务器地分布数据库和数据负荷:能够以最小的数据丢失快速地恢复,提供多种备份 ...

  7. CSS3实现的立体button

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. 动态规划求解序列问题(LIS、JLIS)

    1. 最长递增子序列 不要求位置连续:要求大小严格递增(strictly increasing) 穷举法解题 首先以每个数字为单位分割寻找最长递增子序列: int lis(const vector&l ...

  9. 4、C++快速入门2

    1.抽象类 如果一个类里面有纯虚函数,其被编译器认为是一个抽象类,抽象类不能用来实例化一个对象 纯虚函数定义:virtual void 函数名(void)=  0; 抽象类是给派生类定义好接口函数,如 ...

  10. 26、从零写UVC驱动之分析描述符

    指令:lsusb 可以查看usb设备的描述符信息,当然lsusb指令要带一些参数 一个usb设备有多个config配置+设备描述符,一个config有多个接口和association.config描述 ...