centOS6.5 安装mysql5.7最新版流程

2023-05-16

1检查是否已经安装mysql ,指令:

rpm -qa | grep MySQL

rpm -qa | grep mysql
[root@mysql2 ~]# rpm -qa | grep MySQL
MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
[root@mysql2 ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64


 删除指令:rpm -e  name

[root@mysql2 ~]# rpm -e MySQL-python-1.2.3-0.3.c1.1.el6.x86_64


其他的也删除,上面只是举个例子。

查看系统mysql的版本

[root@mysql2 ~]# yum list mysql*
Loaded plugins: fastestmirror, security
Determining fastest mirrors
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                                                                    | 3.7 kB     00:00     
base/primary_db                                                                                                                                                         | 4.7 MB     00:02     
extras                                                                                                                                                                  | 3.4 kB     00:00     
extras/primary_db                                                                                                                                                       |  27 kB     00:00     
updates                                                                                                                                                                 | 3.4 kB     00:00     
updates/primary_db                                                                                                                                                      | 2.4 MB     00:01     
Installed Packages
mysql.x86_64                                                                    5.1.71-1.el6                                                           @anaconda-CentOS-201311272149.x86_64/6.5
mysql-connector-odbc.x86_64                                                     5.1.5r1144-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
mysql-libs.x86_64                                                               5.1.71-1.el6                                                           @anaconda-CentOS-201311272149.x86_64/6.5
Available Packages
MySQL-python.x86_64                                                             1.2.3-0.3.c1.1.el6                                                     base                                    
mysql.x86_64                                                                    5.1.73-8.el6_8                                                         base                                    
mysql-bench.x86_64                                                              5.1.73-8.el6_8                                                         base                                    
mysql-connector-java.noarch                                                     1:5.1.17-6.el6                                                         base                                    
mysql-devel.i686                                                                5.1.73-8.el6_8                                                         base                                    
mysql-devel.x86_64                                                              5.1.73-8.el6_8                                                         base                                    
mysql-embedded.i686                                                             5.1.73-8.el6_8                                                         base                                    
mysql-embedded.x86_64                                                           5.1.73-8.el6_8                                                         base                                    
mysql-embedded-devel.i686                                                       5.1.73-8.el6_8                                                         base                                    
mysql-embedded-devel.x86_64                                                     5.1.73-8.el6_8                                                         base                                    
mysql-libs.i686                                                                 5.1.73-8.el6_8                                                         base                                    
mysql-libs.x86_64                                                               5.1.73-8.el6_8                                                         base                                    
mysql-server.x86_64                                                             5.1.73-8.el6_8                                                         base                                    
mysql-test.x86_64       

                                
查看以后发现版本过低 

2 yum安装mysql最新版本


下载指令: 
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm 

[root@mysql2 ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm 
--2018-12-21 19:23:56--  http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm%C2%A0
Resolving dev.mysql.com... 137.254.60.11
Connecting to dev.mysql.com|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm%C2%A0 [following]
--2018-12-21 19:24:05--  https://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm%C2%A0
Connecting 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’.


发现不行,更改指令:wget --no-check-certificate  http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm 

[root@mysql2 ~]# wget --no-check-certificate  http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
--2018-12-21 19:43:56--  http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
Resolving dev.mysql.com... 137.254.60.11
Connecting to dev.mysql.com|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm [following]
--2018-12-21 19:44:05--  https://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
Connecting to dev.mysql.com|137.254.60.11|:443... connected.
WARNING: certificate common name “www.mysql.com” doesn’t match requested host name “dev.mysql.com”.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el6-7.noarch.rpm [following]
--2018-12-21 19:44:06--  https://repo.mysql.com//mysql57-community-release-el6-7.noarch.rpm
Resolving repo.mysql.com... 104.77.36.72
Connecting to repo.mysql.com|104.77.36.72|:443... connected.
WARNING: certificate common name “cdn.mysql.com” doesn’t match requested host name “repo.mysql.com”.
HTTP request sent, awaiting response... 200 OK
Length: 8848 (8.6K) [application/x-redhat-package-manager]
Saving to: “mysql57-community-release-el6-7.noarch.rpm”
 
100%[=====================================================================================================================================================>] 8,848       --.-K/s   in 0.005s  
 
2018-12-21 19:44:15 (1.59 MB/s) - “mysql57-community-release-el6-7.noarch.rpm” saved [8848/8848]
 
[root@mysql2 ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  mysql57-community-release-el6-7.noarch.rpm


可以,通过 ls 查看可以看到

安装下载的mysql仓库

[root@mysql2 ~]# rpm -ivh mysql57-community-release-el6-7.noarch.rpm 
warning: mysql57-community-release-el6-7.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql57-community-relea########################################### [100%]


查看源的启用情况

[root@mysql2 ~]# yum repolist enabled
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
mysql-connectors-community                                                                                                                                              | 2.5 kB     00:00     
mysql-connectors-community/primary_db                                                                                                                                   |  27 kB     00:00     
mysql-tools-community                                                                                                                                                   | 2.5 kB     00:00     
mysql-tools-community/primary_db                                                                                                                                        |  45 kB     00:00     
mysql57-community                                                                                                                                                       | 2.5 kB     00:00     
mysql57-community/primary_db                                                                                                                                            | 164 kB     00:00     
repo id                                                                                     repo name                                                                                    status
base                                                                                        CentOS-6 - Base                                                                              6,713
extras                                                                                      CentOS-6 - Extras                                                                               35
mysql-connectors-community                                                                  MySQL Connectors Community                                                                      66
mysql-tools-community                                                                       MySQL Tools Community                                                                           68
mysql57-community                                                                           MySQL 5.7 Community Server                                                                     291
updates                                                                                     CentOS-6 - Updates                                                                             255
repolist: 7,428


看见  MySQL 5.7 Community Server   就可以

查看下现在mysql的版本 yum list mysql-community*

[root@mysql2 ~]# yum list mysql-community*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
Available Packages
mysql-community-client.i686                                                                        5.7.24-1.el6                                                               mysql57-community
mysql-community-client.x86_64                                                                      5.7.24-1.el6                                                               mysql57-community
mysql-community-common.i686                                                                        5.7.24-1.el6                                                               mysql57-community
mysql-community-common.x86_64                                                                      5.7.24-1.el6                                                               mysql57-community
mysql-community-devel.i686                                                                         5.7.24-1.el6                                                               mysql57-community
mysql-community-devel.x86_64                                                                       5.7.24-1.el6                                                               mysql57-community
mysql-community-embedded.i686                                                                      5.7.24-1.el6                                                               mysql57-community
mysql-community-embedded.x86_64                                                                    5.7.24-1.el6                                                               mysql57-community
mysql-community-embedded-devel.i686                                                                5.7.24-1.el6                                                               mysql57-community
mysql-community-embedded-devel.x86_64                                                              5.7.24-1.el6                                                               mysql57-community
mysql-community-libs.i686                                                                          5.7.24-1.el6                                                               mysql57-community
mysql-community-libs.x86_64                                                                        5.7.24-1.el6                                                               mysql57-community
mysql-community-libs-compat.i686                                                                   5.7.24-1.el6                                                               mysql57-community
mysql-community-libs-compat.x86_64                                                                 5.7.24-1.el6                                                               mysql57-community
mysql-community-release.noarch                                                                     el6-7                                                                      mysql57-community
mysql-community-server.x86_64                                                                      5.7.24-1.el6                                                               mysql57-community
mysql-community-test.x86_64                                                                        5.7.24-1.el6                                                               mysql57-community
[root@mysql2 ~]# 


5.7.24应该是最新版,5.7的优势很大

安装mysql5.7.24

yum -y install mysql-server

查看安装情况

[root@mysql2 ~]# rpm -qa | grep mysql
mysql-community-libs-compat-5.7.24-1.el6.x86_64
mysql57-community-release-el6-7.noarch
mysql-community-common-5.7.24-1.el6.x86_64
mysql-community-client-5.7.24-1.el6.x86_64
mysql-connector-odbc-8.0.13-1.el6.x86_64
mysql-community-libs-5.7.24-1.el6.x86_64
mysql-community-server-5.7.24-1.el6.x86_64


启动:

[root@mysql2 ~]# service mysqld start
Initializing MySQL database:                               [FAILED]
[root@mysql2 ~]# service mysqld start
Starting mysqld:                                           [  OK  ]

设置开机启动

chkconfig mysqld on


mysql安装成功后创建的超级用户'root'@'localhost'的密码会被存储在/var/log/mysqld.log,可以使用如下命令查看密码

grep 'temporary password' /var/log/mysqld.log

 

[root@mysql2 ~]# grep 'temporary password' /var/log/mysqld.log
2018-12-21T12:55:02.548184Z 1 [Note] A temporary password is generated for root@localhost: #5o4gtm%H#wS


#5o4gtm%H#wS 这个是我的初始密码

使用mysql生成的'root'@'localhost'用户和密码登录数据库,并修改 其密码,具体命令

[

root@mysql2 ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.24
 
Copyright (c) 2000, 2018, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)


创建用户,允许远程接入:

mysql> grant all on *.* to  test@"%" Identified by "test";
Query OK, 0 rows affected, 1 warning (0.01 sec)
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
 
mysql> 


开通3306端口,就可以远程接入了。

重启mysql服务:

service mysqld restart

#关闭服务
service mysqld stop

启动成功后执行netstat -tunlp|grep 3306就可以看到mysqld已经启动了3306端口的监听。

[root@localhost ~]# netstat -tunlp|grep 3306

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2094/mysqld

附: 几个配置问题

MySQL的my.cnf文件(默认5.7.18下没有my-default.cnf)

 

 

 

大功告成! 
--------------------- 
作者:tanlongkui 
来源:CSDN 
原文:https://blog.csdn.net/tanlongkui/article/details/85158934 
版权声明:本文为博主原创文章,转载请附上博文链接!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

centOS6.5 安装mysql5.7最新版流程 的相关文章

随机推荐

  • mysql 升序和降序

    MySQL排序 有时候很容易记混 xff0c 我这里把他记录了下 xff1a desc是降序 asc是升序 默认不写就是升序 MySql语句 xff1a 1 带条件的排序 select from 表名 where Number 61 1 o
  • mysql filesort 的解决方案

    在explain我们所使用的sql的时候 xff0c 经常会遇到using filesort这种情况 xff0c 原以为是由于有相同列值的原因引起 xff0c 结果昨天看到公司的一个sql xff0c 跟同事讨论了下加上自己又做了一些测试
  • 联合索引优化记录之一

    后台看到一条过3秒的慢查询记录 Time 220629 13 14 21 User 64 Host arp arp 64 172 1 1 32 Id 5966 Query time 3 718737 Lock time 0 000132 R
  • tail -f slow.log tail: inotify cannot be used, reverting to polling

    tail f slow log tail inotify cannot be used reverting to polling tail慢查询日志出现tail inotify cannot be used reverting to pol
  • Rust编译的时候报出link.exe not found错误

    我在Windows 7上面配置Rust运行环境的时候报了下面的错误 xff0c 差点导致我去装Windows11或者换Linux 这个Windows7真是让人头疼 xff0c 各种组件都是缺失的 xff0c 要我一个一个安装 xff0c 缺
  • 配置innodb_flush_method = O_DIRECT引起mysqldump慢

    今天配置my cnf修改一些参数 xff0c mysqldump备份数据时发更慢了几倍 xff0c 由原来的七分钟左路变成要20多分钟才能完成 经测试发现注释innodb flush method 61 O DIRECT后就正常了 下面文章
  • show engine innodb status\G查看mysql死锁记录

    show engine innodb status G及pt deadlock logger都可以查询到deadlock记录 但从使用上我觉得show engine innodb status G显示的结果更清晰 LATEST DETECT
  • 中控门禁无法添加设备,提示表结构不存在或接收超时

    下午供应商给我打通话说新安装了10几个门禁机 xff0c 但无法添加到现在的门禁管理系统 xff0c 用他们测试的门禁系统机器可以正常添加的 折腾一个下午排查网络问题 xff0c 后来注意到可能是软件版本的问题 网上有说可能是门禁机固件版本
  • Windows资源管理器连接 FTP 跳转到浏览器的解决方法

    启动 InternetExplorer 在 菜单栏 选择 工具 gt Internet 选项 gt 高级 gt 勾选 启用 FTP 文件夹视图 xff08 在InternetExplorer之外 xff09 然后单击 确定 xff08 如果
  • pve 无法删除虚拟机

    在clone时没有先停止clone任务就删除虚拟机导致web无法删除虚拟机102 在pve的shell执行 root 64 pve etc pve qm destroy 102 VM is locked clone root 64 pve
  • 批量截取xml中的文件下载链接

    http proteomecentral proteomexchange org cgi GetDataset ID 61 PXD020252 0 2 amp outputMode 61 XML amp test 61 no 浏览器打开上面
  • Running a MacOS 13 Ventura VM in VMware

    Installing and Configuring VMware Download a MacOS Ventura iso Download Download VMware Workstation Player Download Down
  • SRATOOLKIT安装使用教程for_win

    SRATOOLKIT安装使用教程for win 软件下载 官网下载 xff1a https github com ncbi sra tools wiki 01 Downloading SRA Toolkit 内部下载 xff1a http
  • 打开文件就蓝屏,终止代码:INVALID_CANCEL_OF_FILE_OPEN

    同事反映文件一打开就蓝屏 xff0c 并提示 终止代码 INVALID CANCEL OF FILE OPEN 在我的电脑打开一样马上蓝屏 xff0c 想试试复制到我电脑看看 xff0c 发现不给复制 xff0c 开始以为是IPguard的
  • windows提示“你的数据将在你所在的国家或地区之外进行处理”

    关于windows系统提示数据境外处理 1 提示的原因 2022年7月 xff0c 国家互联网信息办公室出台 数据出境安全评估办法 xff0c 明确数据出境合规的要求 中华人民共和国个人信息保护法 于2021年11月1日起施行 上述法规明确
  • Fedora或CentOS运行dnf update报错

    今天我照常打开电脑 xff0c 随手运行了一句sudo dnf update xff0c 然后屏幕输出了一堆错误信息 xff0c 我挨个删除仓库 xff0c 最后事情越搞越乱 xff0c 只好把除了NVIDIA以外的更新源全删了 这下芭比Q
  • 高通410的随身WiFi刷完Debian在刷回安卓的教程

    看到有些朋友刷了debian不知道如何回安卓 xff0c 我这里发一个debian回安卓的教程 首先 xff0c 你需要有一份安卓的备份文件 xff0c 这里我先教大家如何备份安卓的全包 xff08 这里发的是安卓的教程 xff0c 如果没
  • 使用python 自动给微信好友发送消息 pyautogui库下载

    使用Python pyautogui xff0c 实现全自动微信发消息 xff0c 带交互功能 直接输入好友的备注 想发送的次数以及发送的内容 xff0c 即可实现自动查找该好友并对该好友发送指定的消息 先直接上代码 xff0c 后文会给出
  • js实现自动复制 弹框自动消失功能

    有个需求 xff0c 下拉框选中后自动获取下拉框内的值 xff0c 即自动复制功能 所以会用到document execCommand 34 Copy 34 这个功能 xff0c 但是需要先执行select xff0c 才能copy xff
  • centOS6.5 安装mysql5.7最新版流程

    1检查是否已经安装mysql 指令 xff1a rpm qa grep MySQL rpm qa grep mysql root 64 mysql2 rpm qa grep MySQL MySQL python 1 2 3 0 3 c1 1