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

首先是下载与安装

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

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

[root@APP1 /]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
---- ::-- http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:... connected.
HTTP request sent, awaiting response... Moved Permanently
Location: https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm [following]
---- ::-- https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:... connected.
HTTP request sent, awaiting response... Found
Location: https://repo.mysql.com//mysql-community-release-el7-5.noarch.rpm [following]
---- ::-- https://repo.mysql.com//mysql-community-release-el7-5.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.219.33.198
Connecting to repo.mysql.com (repo.mysql.com)|23.219.33.198|:... connected.
HTTP request sent, awaiting response... OK
Length: (.0K) [application/x-redhat-package-manager]
Saving to: 鈓ysql-community-release-el7-.noarch.rpm? %[====================================================================================================>] , --.-K/s in 0s -- :: ( MB/s) - 鈓ysql-community-release-el7-.noarch.rpm?saved [/] [root@APP1 /]# rpm -ivh mysql-community-release-el7-.noarch.rpm

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

Updating / installing...

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

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

Loaded plugins: fastestmirror, langpacks

base | 3.6 kB ::

extras | 3.4 kB ::

mysql-connectors-community | 2.5 kB ::

mysql-tools-community | 2.5 kB ::

mysql56-community | 2.5 kB ::

updates | 3.4 kB ::

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

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

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

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

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

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

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

Determining fastest mirrors

base: mirrors.btte.net

extras: mirrors..com

* updates: mirrors.sohu.com

Resolving Dependencies

--> Running transaction check

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

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

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

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

--> Running transaction check

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

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

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

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

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

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

--> Running transaction check

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

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

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

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

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

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

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

--> Running transaction check

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

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

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

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

--> Running transaction check

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

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

--> Finished Dependency Resolution Dependencies Resolved Package Arch Version Repository Size



Installing:

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

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

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

Installing for dependencies:

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

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

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

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

perl-DBI x86_64 1.627-.el7 base k

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

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

perl-PlRPC noarch 0.2020-.el7 base k Transaction Summary

==============================================================================================================================================

Install Packages (+ Dependent packages) Total download size: M

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

Downloading packages:

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

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

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

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

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')

Trying other mirror.

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

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

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

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

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

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

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

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')

Trying other mirror.

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

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

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

----------------------------------------------------------------------------------------------------------------------------------------------

Total kB/s | MB ::

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

Importing GPG key 0x5072E1F5:

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

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

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

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

Is this ok [y/N]: y

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Verifying : :mariadb-libs-5.5.-.el7.x86_64 / Installed:

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

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

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

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

mariadb-libs.x86_64 :5.5.-.el7 Complete!

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

安装成功后重启mysql服务

# service mysqld restart

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

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

affiliates. Other names may be trademarks of their respective

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

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

+--------------------+

rows in set (0.00 sec) mysql>

设置密码

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

Bye

配置编码格式

mysql> default-character-set =utf8
->

设置允许远程连接

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

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

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. SpringMVC-如何接收各种参数(普通参数,对象,JSON, URL)

    在交互的过程中,其中一个关键的节点就是获取到客户端发送过来的请求参数,本篇文章,我们来罗列下SpringMVC对于各种数据的获取方式: 说明:以下重点在讲解如何获取参数上,所以返回的数据不是重点 1, ...

  2. html5 10大html5前端框架

    Bootstrap 首先说 Bootstrap,估计你也猜到会先说或者一定会有这个( 呵呵了 ),这是说明它的强大之处,拥有框架一壁江山的势气.自己刚入道的时候本着代码任何一个字母都得自己敲出来挡我者 ...

  3. OC学习篇之---Foundation框架中的其他类(NSNumber,NSDate,NSExcetion)

    1.NSNumber 这个类主要是用来封装基本类型的,说到这里,就不得不说一下了: OC中的集合是不允许存入基本类型的,所以NSNumber类就诞生了,需要将基本类型封装一下,然后存进去,这个类似于J ...

  4. Linux下交叉编译gdb,gdbserver+gdb的使用以及通过gdb调试core文件

    交叉编译gdb和gdbserver 1.下载gdb:下载地址为:http://ftp.gnu.org/gnu/gdb/按照一般的想法,最新版本越好,因此下载7.2这个版本.当然,凡事无绝对.我们以gd ...

  5. 【7001】n阶法雷序列

    Time Limit: 10 second Memory Limit: 2 MB 问题描述      对任意给定的一个自然数n(n<=100),将分母小于等于n的不可约的真分数按上升的次序排序, ...

  6. Nginx+Tomcat的配合使用

    近期尝试使用tomcat和Nginx进行配合做负载均衡和静态与动态资源分配的Demo,期间遇到很多有意思的地方和知识短板,特此记录 一:什么是Nginx? Nginx也是一款服务器,我们常用它做如:反 ...

  7. [Angular] Show a loading indicator in Angular using *ngIf/else, the as keyword and the async pipe

    The network may be unreliable and loading data may take time. Thus it is important to give the user ...

  8. generating permunation——全排列(算法汇总)

    本文一共提供了4种全排列的方法,包括递归非字典序版本.递归字典序版本.标准库版本和BFS字典序版本,当然BFS非字典序实现相对于BFS字典序版本更加简洁,稍加修改即可. 说明:递归版本基于网上现有代码 ...

  9. php二维数组中的查找(善于利用基础函数)

    php二维数组中的查找(善于利用基础函数) 一.总结 真没必要完整的写函数,善于借用 1.array_search()是在以为数组中来找,现在我们要在二维数组数组中来,肯定要借用这个 2.!==fal ...

  10. ZOJ Special AC String 水

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3702 题目大意: 对于给定的一个字符串,满足如下要求输出AC,否则WA(好吧我 ...