linux(Centos7)下安装mysql8.0.18的教程图解
程序员文章站
2022-06-12 22:46:40
1 获取安装资源包 mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
链接: https://pan.baidu.com/s/1hjrnvedopov...
1 获取安装资源包 mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
链接: https://pan.baidu.com/s/1hjrnvedopovf4_zntjraia
提取码: rsif
2 在/usr/local目录下新建目录mysql8
cd /usr/local mkdir mysql
3 将下载的资源包(mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar)上传到 usr/local/mysql8 目录下,并解压
tar -xvf mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
4 rpm -qa | grep mariadb 命令查看 mariadb 的安装包5 rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps 卸载mariadb
rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps
6 依次安装
mysql-community-common-8.0.15-1.el7.x86_64.rpm, mysql-community-libs-8.0.18-1.el7.x86_64.rpm mysql-community-client-8.0.18-1.el7.x86_64.rpm mysql-community-server-8.0.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-8.0.18-1.el7.x86_64.rpm rpm -ivh mysql-community-client-8.0.18-1.el7.x86_64.rpm rpm -ivh mysql-community-server-8.0.18-1.el7.x86_64.rpm
7 查看已安装资源
rpm -qa | grep mysql
8 初始化
mysqld --initialize 初始化 chown mysql:mysql /var/lib/mysql -r 授权 systemctl start mysqld 开启mysql服务 systemctl status mysqld 查看mysql 状态 cat /var/log/mysqld.log | grep password 查看root初始密码
10 使用root用户登录mysql ,并修改root用户密码
mysql -u root -p #回车之后输入前面的初始密码也就是 iv7fjup,uch+(填自己的密码) alter user "root"@"localhost" identified by "自己的密码"; flush privileges; #立即生效
再次用户root 用户登录 输入自己刚刚修改的密码就可以了
11 远程连接
use mysql; update user set host = '%' where user ='root'; alter user 'root'@'%' identified by 'password' password expire never; #更改加密方式 alter user 'root'@'%' identified with mysql_native_password by '自己的密码'; #更新用户密码 (我这里为root )
连接成功
参考文章
总结
以上所述是小编给大家介绍的linux(centos7)下安装mysql8.0.18的教程图解,希望对大家有所帮助
推荐阅读