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 ...
随机推荐
- Django+xadmin打造在线教育平台(六)
九.课程章节信息 9.1.模板和urls 拷贝course-comments.html 和 course-video.html放入 templates目录下 先改course-video.html,同 ...
- 大数据 --> CAP原理和最终一致性
CAP原理和最终一致性 CAP原理和最终一致性(Eventually Consistency)
- 设计模式 --> (12)装饰模式
装饰模式 时常会遇到这样一种情况,我已经设计好了一个接口,并且也有几个实现类,但是这时我发现我设计的时候疏忽了,忘记了一些功能,或者后来需求变动要求加入一 些功能,最简单的做法就是修改接口,添加函数, ...
- 0x02 译文:Windows桌面应用Win32第一个程序
本节课我们将用C++ 写一个最简单的Windows 程序. 目录: 创建一个窗口 窗口消息 编写窗口过程 绘制窗口 关闭窗口 管理应用程序状态 代码如下: #ifndef UNICODE #defin ...
- windows环境下,apache虚拟主机配置
在windows环境下,apache从配置文件的相关配置: Windows 是市场占有率最高的 PC 操作系统, 也是很多人的开发环境. 其 VirtualHost 配置方法与 Linux 上有些差异 ...
- C语言:第0次作业
问题1: 你为什么选择计算机专业?你认为你的条件如何?和这些博主比呢? 感性地讲,高中时意外看到了电影<社交网络>,自那时起就将将马克扎克伯格视为偶像,他天才的智慧和长远的眼光深深吸引了我 ...
- python的Collections 模块
Collections 模块 知识点 Counter 类 defaultdict 类 namedtuple 类 在这个实验我们会学习 Collections 模块.这个模块实现了一些很好的数据结构,它 ...
- PHP、Java、Python、C、C++ 这几种编程语言都各有什么特点或优点
PHP.Java.Python.C.C++ 这几种编程语言都各有什么特点或优点 汇编: C: Java: C#: PHP: Python: Go: Haskell: Lisp: C++: &l ...
- Flask 学习 十二 用户评论
评论在数据库中的表示 由于评论和2个模型有关系,分别是谁发了评论,以及评论了哪个文章,所以这次要更新数据库模型 models.py 创建用户评论数据库模型 class Comment(db.Model ...
- 07-TypeScript的For循环
在传统的JavaScript中,关于循环,可以有两种方式,一种是forEach,一种是for. forEach的用法如下: var sarr=[1,2,3,4]; sarr.desc="he ...