centos 7 安装MySQL 5.7.23

Posted orcl-2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 7 安装MySQL 5.7.23相关的知识,希望对你有一定的参考价值。

centos 7 安装MySQL 5.7.23

 

1、  上传mysql安装包到服务器
mysql-5.7.23-linux-glibc2.5-x86_64.tar.gz

 

2、  解压MySQL安装包
tar -zxvf mysql-5.7.23-linux-glibc2.5-x86_64.tar.gz
 

3、  将解压的安装包移动到/usr/local下并命名为mysql-------(typically /usr/local/mysql)

mv mysql-5.7.23-linux-glibc2.5-x86_64 /usr/local/mysql
 

Directory

Contents of Directory

bin

mysqld server, client and utility programs

docs

MySQL manual in Info format

man

Unix manual pages

include

Include (header) files

lib

Libraries

share

Error messages, dictionary, and SQL for database installation

support-files

Miscellaneous support files

 

4、  添加用户组mysql

shell> groupadd mysql 

 

5、  添加用户mysql

   shell> useradd -r -g mysql -s /bin/false mysql

 

6、  创建目录
mkdir –p /usr/local /mysql/data

7、  修改目录权限
Chown –R mysql:mysql /usr/local /mysql
 

8、  初始化mysql数据库,并记录临时密码
/usr/local/mysql/bin/mysqld –initialize –user=mysql –datadir=/usr/local /mysql/data
 

9、  数据库加密
/usr/local/mysql/bin/mysql_ssl_rsa_setup –datadir=/usr/local /mysql/data
 

10、       vi /etc/my.conf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local /mysql/data
socket=/tmp/mysql.sock
 

11、       cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
修改启动脚本参数
vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local /mysql/data
 

12、       启动mysql
chkconfig –add mysqld
/etc/init.d/mysqld start
 

13、       登录
mysql –uroot –p’临时密码’
 

14、       修改登录密码
set password=password(‘mysql’);
 

15、       配置环境变量

export DATADIR=/usr/local /mysql/data

export BASEDIR=/usr/local/mysql

export PATH=$BASEDIR/bin:$PATH

以上是关于centos 7 安装MySQL 5.7.23的主要内容,如果未能解决你的问题,请参考以下文章

Centos6.5安装mysql-5.7.23

CentOS 7 安装 MySQL 5.7

CentOS7 下 MySQL 5.7.23 & XtraBackup 24 做数据备份——安装软件

Linux CentOS7.5上二进制安装MySQL5.7.23

centos7.1上安装Mysql5.7.23

Linunx-CentOS7安装mysql-5.7.23-linux-glibc2.12-x86_64.tar