删除旧包:

# rpm -qa | grep -i mysql
# rpm -ev mysql-libs-* --nodeps

安装rpm包:

# rpm -ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm
# rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm
# rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm
# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm

启动、停止:

# service mysqld start
# service mysqld stop
# service mysqld status

初始随机密码:

# cat /var/log/mysqld.log | more

修改初始密码及授权远程访问:

//如果有报错,可以先升级下数据库结构

# mysql_upgrade -u root -p

# mysql -uroot -p
mysql> set password='Pwd@123456';
mysql> grant all privileges on *.* to 'root'@'%' identified by 'Pwd@123456';

密码复杂度属性:

mysql> set global validate_password_policy=0;

validate_password_policy有以下取值:(默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。)

Policy Tests Performed
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG

Length; numeric, lowercase/uppercase, and special characters; dictionary file

修改数据目录:

新目录需要给mysql用户授权,mysqld_safe日志文件授权,关闭selinux(没找到相关策略设置的方法)

# mkdir /data/mysql/data
# mv /var/lib/mysql/* /data/mysql/data/
# mkdir /data/mysql/log
# chown mysql:mysql -R /data/mysql
# touch mysqld_safe.log
# chown mysql:mysql mysqld_safe.log
# vi /etc/my.cnf
/**
[client]
port = 3306
socket = /data/mysql/log/mysql.sock
default-character-set=utf8 [mysql]
no-auto-rehash
socket=/data/mysql/log/mysql.sock
default-character-set=utf8 [mysqld]
port = 3306
socket = /data/mysql/log/mysql.sock
character-set-server=utf8
lower_case_table_names=1
basedir=/usr
datadir=/data/mysql/data
log-error=/data/mysql/log/error.log
pid-file=/data/mysql/log/mysql.pid
init_connect='SET NAMES utf8'
symbolic-links=0 skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M [mysqld_safe]
log-error=/data/mysql/log/mysqld_safe.log
*/
# getenforce
Enforcing
# setenforce 0
# vi /etc/selinux/config
/**
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
*/
# service mysqld start

其他命令:

# mysqladmin -u root -p password
mysql> select version(); # chkconfig --list
# chkconfig --level 345 mysqld on
# netstat -na | grep 3306 mysql> CREATE USER 'username'@'host' IDENTIFIED BY 'password'; # service mysqld --initedialize
Usage: /etc/init.d/mysqld {start|stop|status|restart|condrestart|try-restart|reload|force-reload}
# service mysqld start
Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]

linux MySQL5.7 rpm安装(转)的更多相关文章

  1. MySQL5.5 RPM安装的默认安装路径

    MySQL5.5 RPM安装的默认安装路径 2011-06-20 10:34:32|  分类: MySQL|举报|字号 订阅   下载LOFTER客户端     由于一客户要求安装mysql- 5.5 ...

  2. mysql5.6 rpm安装配置

    检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)   [root@localhost share]# rpm -qa | grep -i mysql MySQL-cli ...

  3. Linux命令之rpm安装命令

    在 Linux 操作系统下,几乎所有的软件均通过RPM 进行安装.卸载及管理等操作.RPM 的全称为Redhat Package Manager ,是由Redhat 公司提出的,用于管理Linux 下 ...

  4. centos7 mysql5.7 rpm 安装

    卸载MariaDB CentOS7默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包.因为MariaDB和MySQL可能会冲突,故先卸载MariaDB. 查看已安 ...

  5. Linux 上通过rpm安装mysql

    安装mysql之前要remove掉系统自带的mysql: rpm -qa | grep "MySQL*"    和rpm -qa | grep mysql  要确保卸载干净 rpm ...

  6. Linux(CentOS7)下rpm安装MySQL8.0.16

    记录一下自己在 CentOS7 下 rpm 安装 MySQL8.0.16 的过程. 一.准备工作 1. 下载MySQL所需要的安装包 从 MySQL官网 下载,上传至 CentOS 系统 /usr/l ...

  7. Linux MySql5.6.38安装过程

    1.下载mysql安装包mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz 2.用xftp工具将其上传到Linux服务器上的soft文件夹,没有的话先创建 [root ...

  8. mysql5.7 rpm安装教程

    注意版本和此次更新时间 2017-12-03  版本:mysql-5.7.20-1.el6.x86_64  环境:linux6.x ​官方下载地址: wget https://dev.mysql.co ...

  9. Linux MySQL5.5的安装

    1.安装cmake [root@server1 src]# cd /opt/ipnms/src[root@server1 src]# tar zxvf cmake-2.8.4.tar.gz[root@ ...

随机推荐

  1. Markdown_word_chain_test2222

    # Flutter ![Flutter logo][]   [![Gitter Channel][]][Gitter badge] [![Build Status - Cirrus][]][Build ...

  2. markdown入门基础------程序员必备技能

    本人博客:https://blog.csdn.net/qq_39576571/article/details/97256521 ·首先:什么是markdown markdown是一种轻量级的标记语言, ...

  3. vue-cli中跨域问题解决方法

    webpack提供了配置代理的方法解决跨域 1 在vue-cli项目中打开webpack.dev.cof.js,如下 2 打开conifg目录下的index.js,在 proxyTable中进行配置 ...

  4. golang学习笔记 ---interface

    1. 什么是interface接口 interface 是GO语言的基础特性之一.可以理解为一种类型的规范或者约定.它跟java,C# 不太一样,不需要显示说明实现了某个接口,它没有继承或子类或“im ...

  5. asp.net core mvc 集成miniprofiler

    原文:asp.net core mvc 集成miniprofiler asp.net core mvc 集成miniprofiler 一.环境介绍 二.监控asp.net 页面 三.监控执行的sql语 ...

  6. 自定义 Windows 右键菜单项

    注:本文涉及到注册表操作,不认识请不要随意修改! 右键菜单项储存在注册表 HKEY_CLASSES_ROOT 中,一般各种程序的右键菜单项都可以在此项下面找到: 添加右键菜单项 右键单击 shell, ...

  7. YAML语言简明教程

    编程免不了要写配置文件,如果你还在用xml/ini/json,就有点过时了,怎么写配置也是一门学问. YAML 是专门用来写配置文件的语言,非常简洁和强大,远比 JSON 格式方便. 本文介绍 YAM ...

  8. 单词diamaund钻石diamaund英文

    Diamond Di"a*mond (?; 277), n. [OE. diamaund, the hardest iron, steel, diamond, Gr. . Perh. the ...

  9. Android中自定义水球

    如图所示: 自定义属性: 在values下创建attrs.xml 文件 <?xml version="1.0" encoding="utf-8"?> ...

  10. CSS 基础样式

    文本 p{ font-family:Cambria, "Hoefler Text", "Liberation Serif", Times, "Time ...