Centos安装mysql5.7
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
网站名称:Centos安装mysql5.7
网页地址:http://scyingshan.cn/article/igdsgg.html