mysql 5.7数据库安装部署

发布时间:2020-08-10 17:54:23 作者:熊猫咪咪
来源:ITPUB博客 阅读:164

一、安装依赖环境:

yum -y install libaio libaio-devel libtool make automake autoconf numactl numactl-devel bzip2 gcc gcc-c++ perl perl-DBI perl-ExtUtils-MakeMaker perl-devel perl-Time-HiRes perl-DBD-MySQL pcre-devel time jemalloc gperf cmake zlib-devel openssl-devel readline-devel readline glib2-devel mysql-devel qpress which netstat

wget  http://repositories.voole.com/jemalloc-4.0.4.tar.bz2
tar xjf jemalloc-4.0.4.tar.bz2
cd jemalloc-4.0.4
./autogen.sh
make && make install
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf
ldconfig

二、下载二进制包并部署:
cd /opt/soft
wget  http://repositories.voole.com/Percona-Server-5.7.21-20-Linux.x86_64.ssl101.tar.gz
tar zxvf Percona-Server-5.7.21-20-Linux.x86_64.ssl101.tar.gz
mv Percona-Server-5.7.21-20-Linux.x86_64.ssl101 /usr/local/mysql

三、创建mysql用户组
groupadd mysql && useradd -g mysql -M -s /sbin/nologin mysql

四、创建数据库文件my.cnf ,统一放到程序目录里
mv /etc/my.cnf /etc/my.cnf.bak
SSD固态盘:wget  http://repositories.voole.com/my57_19.cnf  -O /etc/my.cnf
SATA磁盘:wget  http://repositories.voole.com/my57_19_sata.cnf  -O /etc/my.cnf
从库:wget  http://repositories.voole.com/my_slave.cnf  -O /etc/my.cnf
主库:wget  http://repositories.voole.com/my_master.cnf  -O /etc/my.cnf

五、初始化,记得加上配置文件
/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize

六、设置环境变量
echo "export PATH=/usr/local/mysql/bin:$PATH">>/etc/profile && source /etc/profile
which mysql

七、修改属主属组
chown -R mysql.mysql /opt/mysql_data

八、启动mysql5.7服务
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
/etc/init.d/mysql start

九、重置密码(mysql5.7和其他版本不同、初次安装会生成一个随机密码在/opt/mysql_data/logerr.err日志内)
密码在logerr.err 中会默认生成一个

set password=password('123456');
如果需要再次修改root密码
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';

十、设置访问权限

grant all on  .  to root@"%" identified by "mysql*()";


推荐阅读:
  1. MySQL和MariaDB(安装部署,数据库操作,SQL语句)日记整理
  2. mysql5.7如何安装部署、初始化和创建实例方法介绍

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql 安装 数据库

上一篇:网络号与主机号的计算

下一篇:MySQL5.7初始密码查看及重置

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》