赞
踩
https://dev.mysql.com/downloads/mysql/
点击链接,根据服务器CPU架构、系统选择对应的安装包
# 3.1查看是否安装
rpm -qa | grep mysql
# 3.2有就remove
yum remove mysql
rpm -e mysql # 普通删除模式
rpm -e --nodeps mysql # 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
# 3.3检查同脉mariadb
rpm -qa | grep mariadb
# 3.4有就删除
rpm -e mariadb-libs-5.5.65-2.el7.x86_64 --nodeps
rpm -qa | grep mariadb
# 4.1.解压
tar -xvf mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar
# 4.2.安装
命令安装 common
rpm -ivh mysql-community-common-8.0.22-1.el7.x86_64.rpm --nodeps --force
命令安装 libs
rpm -ivh mysql-community-libs-8.0.22-1.el7.x86_64.rpm --nodeps --force
命令安装 client
rpm -ivh mysql-community-client-8.0.22-1.el7.x86_64.rpm --nodeps --force
命令安装 server
rpm -ivh mysql-community-server-8.0.22-1.el7.x86_64.rpm --nodeps --force
# 4.3check :查看 mysql 的安装包
rpm -qa | grep mysql
初始化
mysqld --initialize
chown mysql:mysql /var/lib/mysql -R
systemctl enable mysqld
systemctl start mysqld.service
遇报错,执行以下命令
# 报错:mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such
yum -y install numactl
# 报错:Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
#查看是否存在mysql 文件夹
cd /var/lib
ls -ahl
# 存在,则删除
rm -rf ./mysql
# 重启并查看状态,ok,done.
systemctl start mysqld.service
systemctl status mysqld.service
# 查看密码
cat /var/log/mysqld.log | grep password
# 修改密码
# 1进入mysql
mysql -uroot -p 敲回车
# 编辑密码
alter user 'root'@'localhost' identified by 'Cupster@666';
# 设置远程权限,可视化数据库工具连接设置
create user 'root'@'%' identified with mysql_native_password by 'Cupster@666';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。