CentOS在线安装Mysql5.7
一、通过Yum命令安装
1.下载rpm安装源
官方地址:https://dev.mysql.com/downloads/repo/yum/
rpm文件地址:https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
1)通过wget命令下载文件
[root@localhost ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
---- ::-- https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:... 已连接。
已发出 HTTP 请求,正在等待回应... Found
位置:https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [跟随至新的 URL]
---- ::-- https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 23.1.165.122
正在连接 repo.mysql.com (repo.mysql.com)|23.1.165.122|:... 已连接。
已发出 HTTP 请求,正在等待回应... OK
长度: (25K) [application/x-redhat-package-manager]
正在保存至: “mysql57-community-release-el7-.noarch.rpm” %[==================================================================================================================================================================================================>] , --.-K/s 用时 .1s -- :: ( KB/s) - 已保存 “mysql57-community-release-el7-.noarch.rpm” [/]) [root@localhost ~]#
2.安装Mysql
1)安装Mysql源文件
yum localinstall -y mysql57-community-release-el7-11.noarch.rpm
2)查看Mysql源是否安装成功
[root@localhost ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community
mysql-tools-community/x86_64 MySQL Tools Community
mysql57-community/x86_64 MySQL 5.7 Community Server
[root@localhost ~]#
3)安装Mysql服务
yum install -y mysql-community-server
4)查看Mysql服务是否安装成功
[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld()
http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@localhost ~]#
3.启动Mysql
systemctl start mysqld
4.修改root登录密码
1)获取root默认密码(由于Mysql安全策略升级,安装完成后系统自动设置了一个随机密码)
[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log
--08T09::.780623Z [Note] A temporary password is generated for root@localhost: auw;Nj7J!j/J
[root@localhost ~]#
2)登录Mysql
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. 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>
3)修改密码
3.1)由于Mysql默认要求设置密码复杂度高(必须包含 大小写字母、数字、符号)
mysql> alter user 'root'@'localhost' identified by '';
ERROR (HY000): Your password does not satisfy the current policy requirements
mysql>
这样设置是合法的:
mysql> alter user 'root'@'localhost' identified by 'Mysql666!';
Query OK, rows affected (0.00 sec) mysql>
3.2)关闭Mysql密码校验规则,允许设置简单密码
3.2.1)在Mysql配置文件最后加入:validate_password = off
[root@localhost ~]# vi /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links= log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid validate_password = off
3.2.2)重启Mysql服务生效
systemctl restart mysqld
4)设置简单密码 :)
mysql> alter user 'root'@'localhost' identified by '';
Query OK, rows affected (0.00 sec) mysql>
5.配置远程用户登录
1)指定Ip
mysql> grant all privileges on *.* to 'root'@'192.168.1.1' identified by '' with grant option;
Query OK, rows affected, warning (0.00 sec) mysql>
2)允许所有
mysql> grant all privileges on *.* to 'root'@'%' identified by '' with grant option;
Query OK, rows affected, warning (0.00 sec) mysql>
6.设置开机启动
systemctl enable mysqld
systemctl daemon-reload
7.其他
1)已配置远程访问权限,依然不能登录?请检查系统是否开启了防火墙。
1.1)CentOS关闭防火墙
systemctl stop firewalld.service
1.2)禁止防火墙开机启动
systemctl disable firewalld.service
2)Mysql客户端软件(推荐)
2.1)SQLyog(官网:https://sqlyog.en.softonic.com/)
2.2)Navicat(官网:https://www.navicat.com/en/)
CentOS在线安装Mysql5.7的更多相关文章
- CentOS 通过yum在线安装MySQL5.7
CentOS 通过yum在线安装MySQL5.7 Step1: 检测系统是否自带安装mysql # yum list installed | grep mysql Step2: 删除系统自带的mysq ...
- centos在线安装svn
centos在线安装svn 用下列命令安装svn服务 yum install subversion 创建svn版本库目录 mkdir -p /var/svn/svnrepos 创建版本库 svnadm ...
- Linux系统 Centos7/Centos6.8 yum命令在线安装 MySQL5.6
Linux系统 Centos7 yum命令在线安装 MySQL5.6 标签: centosmysqlyum 2015-11-18 17:21 707人阅读 评论(0) 收藏 举报 分类: Linux ...
- Centos 在线安装 nginx
centos 在线安装 nginx 安装nginx 参考文档: http://nginx.org/en/linux_packages.html 中的RHEL/CentOS章节,按照步骤安装repo ...
- CentOS在线安装RabbitMQ3.7
一.通过yum命令在线安装RabbitMQ yum在线安装,简单.快捷.自动安装相关依赖包. 1.安装Erlang环境(RabbitMQ由Erlang语言开发) 1.1)下载rpm安装包 官方地址:h ...
- 在centos上安装mysql5.7的三种方法
带OS信息的是已编译的二进制文件,不带OS信息的是源码包 mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz 二进制包 mysql-5.5.51.tar.gz 源码包 ...
- centos 7安装mysql5.5
首先centos7 已经不支持mysql,因为收费了你懂得,所以内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb,以下为卸载mariadb,安 ...
- CentOS在线安装JDK
一.通过yum命令在线安装jdk 1.查看云端目前支持安装的jdk版本 [root@localhost ~]# yum search java|grep jdk ldapjdk-javadoc.noa ...
- centOS上安装MySQL5.7
在centos上安装mysql,前提得有sudo的权限.没有的话先去跟管理员申请一个. STEP 1 - 安装MySQL 首先打开浏览器访问下 https://dev.mysql.com/downlo ...
随机推荐
- Jquery精妙的自定义事件
对于jQuery自定义事件,很多JavaScript开发者都会有所疑惑:在日常开发过程中会不会用到呢?而本文将结合一个开发案例,其中的一些地方应用到了jQuery的自定义事件,而且达到了很好的效果-精 ...
- Oracle创建用户、角色、授权、建表
oracle数据库的权限系统分为系统权限与对象权限.系统权限( database system privilege )可以让用户执行特定的命令集.例如,create table权限允许用户创建表,gr ...
- C#,一份超简单的数据库帮助类,SqlHelp
简单,实用,留存. using System; using System.Collections.Generic; using System.Configuration; using System.D ...
- C语言助教批改
作业批改 每次作业批改后写一篇作业点评,助教轮流写作业总结.(总结分工老师安排). 每个助教点评自己负责的同学博客,点评要详细,不能只有一句话. 有比较优秀博客请或典型问题推荐到qq群,并发给写总结助 ...
- Beta冲刺NO.3
Beta冲刺 第三天 1. 昨天的困难 1.昨天的困难主要集中在对Ajax的使用上,不熟悉这种语法,所以也就浪费了时间,导致昨天的批量删除没有完全完成. 2.由于之前的网页构造style很乱,导致修改 ...
- 冲刺NO.7
Alpha冲刺第七天 站立式会议 项目进展 前期数据库设计所遗留的问题在今天得到了部分的解决,对物资管理所需要的数据内容进行了细化,但并未开始编写物资相关模块,主要精力还是放在项目的核心功能(信用管理 ...
- The sum of numbers form 0 to n.(20.9.2017)
#include <stdio.h> int main() { int a,b,sum; printf("输入一个数字: "); scanf("%d" ...
- 201621123057 《Java程序设计》第3周学习总结
1. 本周学习总结 初学面向对象,会学习到很多碎片化的概念与知识.尝试学会使用思维导图将这些碎片化的概念.知识点组织起来.请使用工具画出本周学习到的知识点及知识点之间的联系.步骤如下: 1.1 写出你 ...
- [Android]上传到多个Maven仓库的Gradle插件RapidMavenPushPlugin
博客搬迁至https://blog.wangjiegulu.com RSS订阅:https://blog.wangjiegulu.com/feed.xml RapidMavenPushPlugin 用 ...
- 码农、黑客和2B程序员之间的区别
码农: 黑客: 2B程序员: 求2的32次方: 码农: System.out.println(Math.pow(2, 32)); 黑客: System.out.println(1L<<32 ...