阿里云Centos7在线安装mysql5.7

阿里云Centos7在线安装mysql5.7

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
--2018-01-08 16:57:46--  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|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [跟随至新的 URL]
--2018-01-08 16:57:48--  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|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:25680 (25K) [application/x-redhat-package-manager]
正在保存至: “mysql57-community-release-el7-11.noarch.rpm”

100%[==================================================================================================================================================================================================>] 25,680      --.-K/s 用时 0.1s    

2018-01-08 16:57:48 (232 KB/s) - 已保存 “mysql57-community-release-el7-11.noarch.rpm” [25680/25680])

[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           42
mysql-tools-community/x86_64             MySQL Tools Community                55
mysql57-community/x86_64                 MySQL 5.7 Community Server          227
[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(8)
           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
2018-01-08T09:21:45.780623Z 1 [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 3
Server version: 5.7.20

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.

mysql> 

3)修改密码

  3.1)由于Mysql默认要求设置密码复杂度高(必须包含 大小写字母、数字、符号)

mysql> alter user 'root'@'localhost' identified by 'Root@2018';
Query OK, 0 rows affected (0.00 sec)

mysql> 

 3.2)关闭Mysql密码校验规则,允许设置简单密码

  3.2.1)退出mysql ,编辑etc/my.cnf数据库Mysql配置文件,在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 70% of total RAM for dedicated server, else 10%.
# 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=0

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,设置简单密码 :)

mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> 

5.配置远程用户登录

mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> 

6.设置开机启动

 systemctl enable mysqld

 systemctl daemon-reload

7. 在阿里云控制台设置防火墙规则

阿里云Centos7在线安装mysql5.7

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/111274.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • XAMPP安装Windows10

    XAMPP安装Windows10下载XAMPPhttps://sourceforge.net/projects/xampp/files/我下载的是XAMPP7.4.3之后直接双击安装,尽量不要装在C盘,一直点下一步就好了安装完成后会有这样的界面(XAMPP控制面板窗口)(Apache和MySQL之前有写安装教程)点击“Apache”的“Config”键选择“Apache(httpd.conf)”,打开配置文件找…

    2022年7月15日
    14
  • KindEditor配置ctrl+enter提交

    KindEditor配置ctrl+enter提交今天花费了一些时间去想怎么配置,网上也没有直接找到这方面的资料。后面突然看到一个网页,提交也是用了相同的编辑器。就学习了一下。//创建编辑器functioncreateEditor(){KindEditor.ready(function(K){ChatEditor=K.create(‘textarea.win_chat_textarea’,{width:’100%’,

    2022年10月10日
    0
  • OutOfMemoryError系列(1): Java heap space

    OutOfMemoryError系列(1): Java heap space本文通过实例来分析java.lang.OutOfMemoryError:Javaheapspace问题产生的原因,以及相关的解决方案

    2022年7月7日
    21
  • url传递参数_url encode

    url传递参数_url encodeWerkzeug之URL路由原文链接http://werkzeug.pocoo.org/docs/0.12/routing/当需要组合控制器和视图函数时,我们需要一个调度器来实现。一个简单的实现方式是采用正则表达式匹测试路由信息,调用回调函数并返回结果。Werkzeug提供了一个类似Route[1]的强大功能.下文提到的所有对象都是从werkzeug.routing导入而不是

    2022年10月6日
    0
  • docker集群软件之fleet安装

    docker集群软件之fleet安装前几天给大家介绍了docker的集群存储软件etcd的安装(地址http://dl528888.blog.51cto.com/2382721/1623746),今天就再给大家介绍集群的控制软件fleet安装。fleet的介绍,info里复制的fleet 是一个通过 Systemd对CoreOS 集群中进行控制和管理的工具。fleet 与 Systemd 之间通过 D-Bus API 进行交互,每个…

    2022年5月1日
    134
  • 安卓版本命名规则_什么是版本号

    安卓版本命名规则_什么是版本号手机软件完全的版本号定义规则:分三项:..,如1.0.0。修改规则:主版本号:功能模块有大的变动,比如增加多个模块或者整体架构发生变化。次版本号:和主版本相对而言,次版本号的升级对应的只是局部的变动。但该局部的变动造成了程序和以前版本不能兼容,或者对该程序以前的协作关系产生了破坏,或者是功能上有大的改进或增强。修订版本号:局部的变动,主要是局部函数的功能改进,或者bug的修正,或者功能的扩充。w…

    2022年9月11日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号