s7安装M

环境说明:centos7.5,mysql5.7

#卸载系统自带的Mariadb

# rpm -qa | grep mariadb

# rpm -e --nodeps mariadb文件名 

1336432-20181001165125833-1396129148

 

#删除etc目录下的my.cnf文件

# rm -rf /etc/my.cnf

1336432-20181001165337469-1805771994

 

#安装mysql依赖库文件libaio

# yum -y install libaio*

 

#下载压缩包到/usr/local,解压在当前目录并重命名为mysql5.7

# cd /usr/local

# yum install wget

# wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# mv mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz mysql5.7

1336432-20181001170836749-878015155

 

#添加组和用户

# groupadd mysql

# useradd -g mysql mysql

1336432-20181001171008254-890800708

 

#创建配置文件

# vi /etc/my.cnf

[mysqld]

user=mysql

port=3306

basedir=/usr/local/mysql5.7/

datadir=/usr/local/mysql5.7/data/

character-set-server=utf8

collation-server=utf8_bin

1336432-20181001171340425-478195029

 

#创建数据目录并初始化

# mkdir -p /usr/local/mysql5.7/data/

# chown -R mysql:mysql /usr/local/mysql5.7/data/

# /usr/local/mysql5.7/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql5.7 --datadir=/usr/local/mysql5.7/data/&

1336432-20181001171950346-1393432286

A temporary password is generated for root@localhost:这里就是数据库的初始密码

 

#开启mysql服务,用初始密码登录数据,并修改初始密码

# /usr/local/mysql5.7/support-files/mysql.server start

# /usr/local/mysql5.7/bin/mysql -u root -p

> set password=password('新密码');

1336432-20181001172602085-449818540

 

#设置环境变量

# vi /etc/profile

## FOR MYSQL ##

export PATH=/usr/local/mysql5.7/bin:$PATH

# source /etc/profile

1336432-20181001172819962-141025653

 

#设置开机自启动

# cp /usr/local/mysql5.7/support-files/mysql.server /etc/init.d/mysql

# chmod +x /etc/init.d/mysql

# chkconfig --add mysql

# chkconfig --level 35 mysql on

1336432-20181001172957847-1024724131

 

#数据库设置允许远程主机访问

> use mysql;

> update user set host = '%' where user = 'root';

1336432-20181001174127840-1720912555

 

#重启数据库服务

# service mysql stop

# service mysql start

1336432-20181001174229321-461994717

 

#防火墙放开mysql数据库3306端口

# firewall-cmd --zone=public --add-port=3306/tcp --permanent

# firewall-cmd --reload

1336432-20181001174519025-805017804

上一篇:CentOS6.5 安装、配置并启动SSH远程访问具体操作步骤
下一篇:蒸槐花,最忌直接放面粉,牢记3窍门,槐花松散不粘,可口香味足