linux MySQL5.7 rpm安装(转)

删除旧包:

# 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 -uroot -p
mysql> set password=‘[email protected]‘;
mysql> grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘[email protected]‘;

密码复杂度属性:

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  ]

原文地址:https://www.cnblogs.com/spruce/p/12077806.html

时间: 2024-10-03 23:26:37

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

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

MySQL5.5 RPM安装的默认安装路径 2011-06-20 10:34:32|  分类: MySQL|举报|字号 订阅 下载LOFTER客户端 由于一客户要求安装mysql- 5.5.11,apache-2.2.18,php-5.3.6,这些目前来说都是比较新版本.apache-2.2.18,php-5.3.6目前已经 是最新稳定版的.mysql -5系列的mysql编译安装使用cmake,和一往不同.有一报错,尚未解决,据说官方仍未回复.所以我用RPM包给客户安装了mysql- 5.5.

LINUX Mysql5.6.19 安装

1.需要扩展安装 yum -y install make bison gcc-c++ cmake ncurses ncurses-devel 2.下载Mysql5.6.19 wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz 3.解压安装 tar zxvf mysql-5.6.19.tar.gz cd mysql-5.6.19 cmake -DCMAKE_INSTALL_PREFIX=/

Linux命令之rpm安装命令

在 Linux 操作系统下,几乎所有的软件均通过RPM 进行安装.卸载及管理等操作.RPM 的全称为Redhat Package Manager ,是由Redhat 公司提出的,用于管理Linux 下软件包的软件.Linux 安装时,除了几个核心模块以外,其余几乎所有的模块均通过RPM 完成安装.RPM 有五种操作模式,分别为:安装.卸载.升级.查询和验证. 1)用RPM安装软件包,最简单的命令如下: 1 #rpm -i example.rpm 安装 example.rpm 包: 2 #rpm

Linux 上通过rpm安装mysql

安装mysql之前要remove掉系统自带的mysql: rpm -qa | grep "MySQL*"    和rpm -qa | grep mysql  要确保卸载干净 rpm -e MySQL-server-5.1.74-1.el6.x86_64.rpm --nodeps mysql这里使用rpm 安装: 安装包:MySQL-5.6.26-1.linux_glibc2.5.x86_64.rpm-bundle.tar tar xf MySQL-5.6.26-1.linux_glib

centos6.5 mysql5.6 RPM安装

准备工作:    网络源使用163,sohu    安装依赖包:    rpm -ivh  http://mirrors.ustc.edu.cn/epel/6Server/x86_64/epel-release-6-8.noarch.rpm tar xvf http://mirrors.sohu.com/mysql/MySQL-5.6/MySQL-5.6.31-1.el6.x86_64.rpm-bundle.tar yum -y install ntp cmake make openssl op

Oracle Linux 6.5 RPM安装Mysql 5.7.11

安装Oracle Liunx 6.5 开发包全部选择上 不然后面安装Mysql报错 [[email protected] /]# cd /tool [[email protected] tool]# tar -xvf mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar 查看原来安装的Mysql  [[email protected] /]# rpm -qa | grep mysql mysql-5.1.71-1.el6.x86_64 mysql-devel-5.1.

Linux centos6.6 rpm安装与管理

rpm包管理:安装.升级.卸载.查询.检验 安装: rpm {-i|--install} [install-options] PACKAGE_FILE1... -h: hash,以#来表示安装进度: -v, --verbose:显示安装过程中的详细信息: 安装时常用的组合: -ivh --test:不执行真正的安装过程,而仅报告依赖关系及冲突信息等: 程序包之间存在依赖关系: 我们要安装程序包A,程序包A必需依赖程序包B,才能运行.这就是依赖关系. 依赖可能是多层次的,A 依赖 B ,B 依赖

linux下用rpm 安装卸载jdk

1.如果linux是centos的话,请先卸载openjdk java -version ,会有下面的信息: java version "1.6.0_24 卸载默认的用root用户登陆到系统,打开一个终端输入# rpm -qa|grep gcj显示内容其中包含下面两行信息# java-1.4.2-gcj-compat-1.4.2.0-27jpp# java-1.4.2-gcj-compat-devel-l.4.2.0-27jpp卸载# rpm -e java-1.4.2-gcj-compat-d

(一) Linux系统使用 RPM 安装Mysql

一.准备Mysql RPM文件 1. 官网下载 2. 博主网盘下载 3. 把 RPM  放在 /opt 目录下 二.准备安装Mysql 1. 检查是否有安装过Mysql  如果下面命令返回信息则装了Mysql,如果没有返回信息则没装Mysql rpm -qa | grep -i mysql 注:如果已安装,如需重新安装,使用rpm卸载命令如下: rpm -ev 安装过的mysql server rpm -ev 安装过的mysql client 命令使用示例:rpm -ev MySQL-clien