1
从官网上下载MysqL安装包MysqL-5.7.26-1.el7.x86_64.rpm-bundle.tar
2
解压文件:
tar -xvf MysqL-5.7.26-1.el7.x86_64.rpm-bundle.tar
3
本地安装 comm client libs libs-compat dev server 根据实际安装环境安装其他缺失的包
yum localinstall MysqL-community-libs-5.7.26-1.el7.x86_64.rpm MysqL-community-libs-compat-5.7.26-1.el7.x86_64.rpm MysqL-community-common-5.7.26-1.el7.x86_64.rpm MysqL-community-client-5.7.26-1.el7.x86_64.rpm MysqL-community-devel-5.7.26-1.el7.x86_64.rpm MysqL-community-server-5.7.26-1.el7.x86_64.rpm
4
初始化MysqL
mkdir /udata/MysqL
chown MysqL:MysqL /udata/MysqL
修改/etc/my.cnf
datadir=/udata/MysqL 如果修改了socket的位置务必[client] 加上socket 对应的位置
myqld --initialize 并查看MysqL生成的随机密码 ,默认位于 /var/log/MysqLd.log中
5
启动MysqL服务
systemctl enable MysqLd
systemctl start MysqLd
6
MysqL -uroot -p上诉随机密码 连接到MysqL
set password = password('xxx') 修改密码 xxx为修改后的密码
7
update user set host = '%' where host='localhost';
flush privileges
允许其他主机远程连接MysqL