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

转载于:https://www.cnblogs.com/orcl-2018/p/11437656.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值