在centos 7下安装mysql 5.7.17

首先查看系统有没有安装mysql

[[email protected]_167_102_centos ~]# rpm -qa|grep mysql
[[email protected]_167_102_centos ~]# 

结果发现没有,那么我们先下载mysql得rpm包

首先下载server

[[email protected]_167_102_centos mysql]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.17-1.el7.x86_64.rpm
--2017-04-02 17:51:11--  https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.17-1.el7.x86_64.rpm
Resolving cdn.mysql.com (cdn.mysql.com)... 23.219.134.205
Connecting to cdn.mysql.com (cdn.mysql.com)|23.219.134.205|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 169496800 (162M) [application/x-redhat-package-manager]
Saving to: ‘mysql-community-server-5.7.17-1.el7.x86_64.rpm‘

 0% [                                                                                                                              ] 593,988     65.3KB/s  eta 42m 14s

然后下载client

 wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.17-1.el7.x86_64.rpm
--2017-04-02 17:55:12--  https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.17-1.el7.x86_64.rpm
Resolving cdn.mysql.com (cdn.mysql.com)... 23.211.97.88
Connecting to cdn.mysql.com (cdn.mysql.com)|23.211.97.88|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25037548 (24M) [application/x-redhat-package-manager]
Saving to: ‘mysql-community-client-5.7.17-1.el7.x86_64.rpm‘

 7% [=======>                                                                                                                      ] 1,762,140   60.9KB/s  eta 3m 50s 

然后先安装server

[[email protected]_167_102_centos mysql]# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm  --nodeps --force
warning: mysql-community-server-5.7.17-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-5.7.17-1.e################################# [100%]

然后安装client

[[email protected]_167_102_centos mysql]# rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm --nodeps
warning: mysql-community-client-5.7.17-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-5.7.17-1.e################################# [100%]

然后启动mysql服务

[[email protected]_167_102_centos mysql]# service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
[[email protected]_167_102_centos mysql]# 

获取临时密码

[[email protected]_167_102_centos mysql]# grep ‘temporary password‘ /var/log/mysqld.log
2017-04-02T14:55:58.589047Z 1 [Note] A temporary password is generated for [email protected]: k1pki)rKa6HL

然后使用临时密码进入mysql修改密码

[[email protected]_167_102_centos mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.17

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

然后进入etc/my.cnf在[mysqld]下添加一行如下代码

skip-grant-tables

然后在使用刚才得临时密码进入mysql修改root密码

mysql> update mysql.user set authentication_string=password(‘root‘) where user=‘root‘ and Host = ‘localhost‘;
Query OK, 1 row affected, 1 warning (0.00 sec)

然后再把my.cnf文件下刚刚添加得那行代码删除

然后重启mysql

[[email protected]_167_102_centos /]# service mysqld restart
Redirecting to /bin/systemctl restart  mysqld.service
[[email protected]_167_102_centos /]#

然后就可以使用刚才设置得密码进入mysql了

[[email protected]_167_102_centos /]# 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.17

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

设置开机自动重启

[[email protected]_167_102_centos /]# systemctl enable mysqld
[[email protected]_167_102_centos /]# systemctl daemon-reload

为了确保远程能访问还得增加3306端口开放

这样centos7_64位安装mysql5.7.17就搞定啦。

不对得地方请各位大佬指正

时间: 2024-12-24 03:35:02

在centos 7下安装mysql 5.7.17的相关文章

在Centos环境下安装mysql优化工具:pt-query-digest

事前说明,本人使用的是虚拟机做CentOS6.7,主机是windows10,主要用CentOS来安装软件并且操作. 作为运维工作人员掌握MySQL的"增删改查"是必须的,而再学习一点优化也是好的,MySQL自带一个叫"慢查文件"的东西,但是那玩意很基本,虽然很好操作但是能力也很有限,于是pt-query-digest 工具就应运而生,这个软件只有linux版,所以windows的用户可以关闭此页面了. 可以先看看https://www.percona.com/doc

CentOS 7下安装Mysql 5.7

参见http://www.07net01.com/2016/03/1355735.html 过程中需要安装perl CentOS 7 采用了 firewalld 防火墙 service firewalld status 如要查询是否开启80端口则: [[email protected] ~]# firewall-cmd --query-port=80/tcpno显然80端口没有开启 下面我们开启80端口:[[email protected] ~]# firewall-cmd --add-port

CentOS下安装mysql

试着在腾讯云服务器上部署web应用,就想着先搭建一下服务器环境,操作系统选的是centos7,在安装好jdk,tomcat后测试可以部署web应用就准备再安装一个mysql数据库,之前试过好几种方式都是以初始密码找不到告终,这次就又重新百度安装方式. 据说centos7没有mysql 的yum源,于是就直接从网上下载mysql的repo源(这个玩意目前还没仔细探究是什么东西,在centos里面应该会涉及到),使用 wget http://repo.mysql.com/mysql-communit

CentOS 7 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)

原文 CentOS 7 下安装 LEMP 服务(nginx.MariaDB/MySQL 和 php) LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作用.正如其名称所暗示的, LEMP 包是由 Linux.nginx.MariaDB/MySQL 和 PHP 组成的.在传统的 LAMP 包中使用的 Apache HTTP 协议服务器性能低下而且难于大规模集群,相比来说 nginx 的高性能及轻量级等特性,正是其的替代方案. MariaDB 是一款社

Centos | Linux 下安装启动 mysql 出现 8618 [ERROR] Aborting,查看日志:Plugin 'FEDERATED' is disabled.

1.试试启动时指定配置文件 ./bin/mysqld_safe --defaults-file=mysql.cnf 或 ./bin/mysqld_safe --defaults-file=mysql.cnf $ 2.试试修改 mysql.cnf(也可能是my.cnf) 在 [mysqld]下指定tmpdir tmpdir = youTmpdir Centos | Linux 下安装启动 mysql 出现 8618 [ERROR] Aborting,查看日志:Plugin 'FEDERATED'

Centos下安装mysql 总结

一.MySQL安装 Centos下安装mysql 请点开:http://www.centoscn.com/CentosServer/sql/2013/0817/1285.html 二.MySQL的几个重要目录 MySQL安装完成后不象SQL Server默认安装在一个目录,它的数据库文件.配置文件和命令文件分别在不同的目录,了解这些目录非常重要,尤其对于Linux的初学者,因为 Linux本身的目录结构就比较复杂,如果搞不清楚MySQL的安装目录那就无从谈起深入学习. 下面就介绍一下这几个目录.

CentOS 6.5下安装MySQL 5.6.21

Linux中使用最广泛的数据库就是MySQL,使用在线yum的方式安装的版本落后MySQL网站好几个小版本,本节亲自测试安装新版的MySQL. 测试机器环境: VMware Workstation 10 虚拟机 内存:1G Linux版本:CentOS MinimalCD 6.5 JAVA:JAVA_HOME=/opt/jdk 安装mysql前需要查询系统中含有的有关mysql的软件. rpm -qa | grep -i mysql //grep -i是不分大小写字符查询,只要含有mysql就显

CentOS 6.4下安装MySQL 5.6.22

本文详细介绍在CentOS 6.4下安装MySQL 5.6.22的过程,供需要的朋友学习参考. 一.下载MySQL 安装包 1)http://dev.mysql.com/downloads/mysql/ 打开网址: Select Platform: 选择 Linux-Generic 选择选择 Linux - Generic (glibc 2.5) (x86, 64-bit), RPM   进行下载: linux 下下载: wget  http://cdn.mysql.com/Downloads/

centos上如何安装mysql

centos可以使用yum安装mysql 但是版本很低,且不灵活. 本文将介绍如何使用安装包安装mysql http://dev.mysql.com/downloads/mysql/ 下载mysql 将下载文件放在/opt/mysoft文件夹中 解压文件 tar -xf MySQL-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tar 这里我们要安装mysql的服务端和客服端,所以使用下面两个文件: MySQL数据库: MySQL-server-5.6.22