centos mysql二进制包_centos mysql5.7 二进制包安装

此种方式安装非常简单

cd /usr/local

下载安装包

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

解压

tar -zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

[root@www local]# pwd

/usr/local

[root@www local]# mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql

cd mysql

mkdir -p /data/mysql/data

创建mysql 用户

useradd mysql -s /sbin/nologin -M(没有家目录)

chown -R mysql.mysql /data/mysql

./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data

提示初始密码:

2017-03-29T15:09:12.116410Z 1 [Note] A temporary password is generated for root@localhost: ew/Wx(43l

拷贝启动脚本文件

cp support-files/mysql.server /etc/init.d/mysqld

设置开机启动

chkconfig mysqld on

chkconfig --list|grep mysqld

chmod 755 /etc/init.d/mysqld

配置环境变量

echo 'PATH=/usr/local/mysql/bin/:$PATH' >> /etc/profile

. /etc/profile

mkdir -p /data/mysql/log/mariadb

touch  /data/mysql/log/mariadb/mariadb.log

编辑my.cnf

[mysqld]

datadir=/data/mysql/data

socket=/tmp/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mariadb according to the

# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]

log-error=/data/mysql/log/mariadb/mariadb.log

pid-file=/data/mysql/run/mariadb/mariadb.pid

#

# include all files from the config directory

#

!includedir /etc/my.cnf.d

vim /etc/init.d/mysqld  编辑2项:

basedir=/usr/local/mysql

datadir=/data/mysql/data

创建/data/mysql/log/xxx.log

启动mysql   service mysqld start

进入MySQL :

mysql -uroot -p ew/Wx(43l

修改密码

alter user 'root'@'localhost' identified by '123456';

flush privileges;

grant all privileges on *.* to 'root'@'%' identified by '123456';

FLUSH PRIVILEGES;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值