侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

centos 6.5下 mysql-community-server. 5.7.18-1.el6安装

linux  /  管理员 发布于 7年前   181

使用下面的命令检查是否安装有MySQL Server

[root@localhost etc]# rpm -qa | grep mysql // 这个命令就会查看该操作系统上是否已经安装了mysql数据库

   有的话,我们就通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉

[root@localhost ~]# rpm -e mysql  // 普通删除模式[root@localhost ~]# rpm -e --nodeps mysql  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除

   在删除完以后我们可以通过 rpm -qa | grep mysql 命令来查看mysql是否已经卸载成功!!

官网yum repository 下载安装包

[root@localhost ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm --2017-04-24 18:53:49-- http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpmResolving dev.mysql.com... 137.254.60.11Connecting to dev.mysql.com|137.254.60.11|:80... connected.HTTP request sent, awaiting response... 301 Moved PermanentlyLocation: https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm [following]--2017-04-24 18:53:49-- https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpmConnecting to dev.mysql.com|137.254.60.11|:443... connected.ERROR: certificate common name “www.mysql.com” doesn't match requested host name “dev.mysql.com”.To connect to dev.mysql.com insecurely, use ‘--no-check-certificate'

本地安装下载下来的rpm包

[root@localhost ~]# yum localinstall mysql57-community-release-el6-10.noarch.rpmLoaded plugins: fastestmirror, refresh-packagekit, securitySetting up Local Package ProcessExamining mysql57-community-release-el6-10.noarch.rpm: mysql57-community-release-el6-10.noarchMarking mysql57-community-release-el6-10.noarch.rpm to be installedLoading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.cn99.com * updates: mirrors.cn99.comResolving Dependencies--> Running transaction check---> Package mysql57-community-release.noarch 0:el6-10 will be installed--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================== Package          Arch  Version  Repository     Size===============================================================================================================================================================================================Installing: mysql57-community-release noarch el6-10   /mysql57-community-release-el6-10.noarch  30 kTransaction Summary===============================================================================================================================================================================================Install    1 Package(s)Total size: 30 kInstalled size: 30 kIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : mysql57-community-release-el6-10.noarch           1/1 Verifying : mysql57-community-release-el6-10.noarch 1/1Installed: mysql57-community-release.noarch 0:el6-10  Complete!

  查看可用的安装包 

[root@localhost ~]# yum repolist enabled|grep mysqlmysql-connectors-community      MySQL Connectors Community       33mysql-tools-community        MySQL Tools Community          47mysql57-community          MySQL 5.7 Community Server       183

安装前装gcc所有包,防止报错[Errno -1]  Package does not match intended download

[root@localhost yum.repos.d]# yum install gcc* 

安装mysql

[root@localhost yum.repos.d]# yum install -y mysql-community-server Loaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.cn99.com * updates: mirrors.cn99.comSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package mysql-community-server.x86_64 0:5.7.18-1.el6 will be installed--> Processing Dependency: mysql-community-common(x86-64) = 5.7.18-1.el6 for package: mysql-community-server-5.7.18-1.el6.x86_64--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el6.x86_64--> Running transaction check---> Package mysql-community-client.x86_64 0:5.7.18-1.el6 will be installed--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el6.x86_64---> Package mysql-community-common.x86_64 0:5.7.18-1.el6 will be installed--> Running transaction check---> Package mysql-community-libs.x86_64 0:5.7.18-1.el6 will be obsoleting---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64--> Running transaction check---> Package mysql-community-libs-compat.x86_64 0:5.7.18-1.el6 will be obsoleting---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated---> Package postfix.x86_64 2:2.6.6-8.el6 will be an update--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================= Package     Arch        Version           Repository           Size=============================================================================================================================Installing: mysql-community-libs          x86_64       5.7.18-1.el6         mysql57-community       2.1 M   replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-libs-compat       x86_64       5.7.18-1.el6         mysql57-community       1.6 M   replacing mysql-libs.x86_64 5.1.71-1.el6 mysql-community-server         x86_64       5.7.18-1.el6         mysql57-community       152 MInstalling for dependencies: mysql-community-client         x86_64       5.7.18-1.el6         mysql57-community       23 M mysql-community-common         x86_64       5.7.18-1.el6         mysql57-community       328 kUpdating for dependencies: postfix     x86_64       2:2.6.6-8.el6        base 2.0 MTransaction Summary=============================================================================================================================Install    5 Package(s)Upgrade    1 Package(s)Total size: 180 MTotal download size: 152 MDownloading Packages:mysql-community-server-5.7.18-1.el6.x86_64.rpm    | 152 MB   01:41  warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlImporting GPG key 0x5072E1F5: Userid : MySQL Release Engineering <[email protected]> Package: mysql57-community-release-el6-10.noarch (@/mysql57-community-release-el6-10.noarch) From  : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlRunning rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : mysql-community-common-5.7.18-1.el6.x86_64        1/8 Installing : mysql-community-libs-5.7.18-1.el6.x86_64         2/8 Installing : mysql-community-libs-compat-5.7.18-1.el6.x86_64      3/8 Installing : mysql-community-client-5.7.18-1.el6.x86_64        4/8 Installing : mysql-community-server-5.7.18-1.el6.x86_64        5/8 Updating  : 2:postfix-2.6.6-8.el6.x86_64   6/8 Cleanup  : 2:postfix-2.6.6-2.2.el6_1.x86_64 7/8 Erasing  : mysql-libs-5.1.71-1.el6.x86_64  8/8 Verifying : 2:postfix-2.6.6-8.el6.x86_64   1/8 Verifying : mysql-community-libs-compat-5.7.18-1.el6.x86_64      2/8 Verifying : mysql-community-server-5.7.18-1.el6.x86_64        3/8 Verifying : mysql-community-libs-5.7.18-1.el6.x86_64         4/8 Verifying : mysql-community-common-5.7.18-1.el6.x86_64        5/8 Verifying : mysql-community-client-5.7.18-1.el6.x86_64        6/8 Verifying : 2:postfix-2.6.6-2.2.el6_1.x86_64 7/8 Verifying : mysql-libs-5.1.71-1.el6.x86_64  8/8Installed: mysql-community-libs.x86_64 0:5.7.18-1.el6         mysql-community-libs-compat.x86_64 0:5.7.18-1.el6        mysql-community-server.x86_64 0:5.7.18-1.el6       Dependency Installed: mysql-community-client.x86_64 0:5.7.18-1.el6         mysql-community-common.x86_64 0:5.7.18-1.el6        Dependency Updated: postfix.x86_64 2:2.6.6-8.el6           Replaced: mysql-libs.x86_64 0:5.1.71-1.el6Complete!

启动mysql

[root@localhost yum.repos.d]# service mysqld start  Initializing MySQL database:    [ OK ]Installing validate password plugin:[ OK ]Starting mysqld: 

  进入mysql安全模式

[root@localhost yum.repos.d]# killall -TERM mysqld[root@localhost yum.repos.d]# mysqld_safe --skip-grant-tables &[1] 40422[root@localhost yum.repos.d]# 2017-04-25T07:45:39.222061Z mysqld_safe Logging to '/var/log/mysqld.log'.2017-04-25T07:45:39.246117Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysqlmysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.18 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> select * from users;ERROR 1146 (42S02): Table 'mysql.users' doesn't existmysql> select * from user;mysql> update user set authentication_string=PASSWORD('mysql') where user='root';Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 1mysql> quitBye[2]+ Exit 1         mysqld_safe --skip-grant-tables  [root@localhost yum.repos.d]# service mysqld startStarting mysqld:          [ OK ][root@localhost yum.repos.d]# mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.7.18 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql -h主机地址 -u用户名 -p用户密码

1、例1:连接到本机上的MYSQL

   找到mysql的安装目录,一般可以直接键入命令mysql -uroot -p,回车后提示你输密码,如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中

了,MYSQL的提示符是:mysql>

2、连接到远程主机上的MYSQL

   假设远程主机的IP为:10.0.0.1,用户名为root,密码为123。则键入以下命令:

mysql -h10.0.0.1 -uroot -p123

  (注:u与root可以不用加空格,其它也一样)

配置防火墙

防火墙的3306端口默认没有开启,若要远程访问,需要开启这个端口

打开/etc/sysconfig/iptables

在“-A INPUT Cm state --state NEW Cm tcp Cp tcp Cdport 22 Cj ACCEPT”,下添加:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

然后保存,并关闭该文件,在终端内运行下面的命令,刷新防火墙配置:

service iptables restart OK,一切配置完毕,你可以访问你的MySQL了~

注意:增加的开放3306端口的语句一定要在icmp-host-prohibited之前

mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, 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.

以上所述是小编给大家介绍的centos 6.5下 mysql-community-server. 5.7.18-1.el6安装,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对站的支持!


  • 上一条:
    Linux下MySQL 5.5/5.6的修改字符集编码为UTF8的方法
    下一条:
    mysql 5.7.18 安装配置方法图文教程(CentOS7)
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 在Linux系统中使用Iptables实现流量转发功能流程步骤(0个评论)
    • vim学习笔记-入门级需要了解的一些快捷键(0个评论)
    • 在centos7系统中实现分区并格式化挂载一块硬盘到/data目录流程步骤(0个评论)
    • 在Linux系统种查看某一个进程所占用的内存命令(0个评论)
    • Linux中grep命令中的10种高级用法浅析(0个评论)
    • 近期文章
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • Laravel 11.15版本发布 - Eloquent Builder中添加的泛型(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-11
    • 2017-07
    • 2017-10
    • 2017-11
    • 2018-01
    • 2018-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-02
    • 2021-03
    • 2021-04
    • 2021-06
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2021-12
    • 2022-01
    • 2022-03
    • 2022-04
    • 2022-08
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-06
    • 2023-07
    • 2023-10
    • 2023-12
    • 2024-01
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客