1 获取安装资源包 mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
链接: https://pan.baidu.com/s/1hJRNvEdOpoVf4_zNtjRaIA
提取码: rsif
2 在/usr/local目录下新建目录mysql8
1
2
|
cd /usr/local mkdir mysql |
3 将下载的资源包(mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar)上传到 usr/local/mysql8 目录下,并解压
1
|
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
1
|
rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps |
6 依次安装
1
2
3
4
|
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 |
1
2
3
4
|
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 查看已安装资源
1
|
rpm -qa | grep mysql |
8 初始化
1
2
3
4
5
6
|
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用户密码
1
2
3
4
|
mysql -u root -p #回车之后输入前面的初始密码也就是 Iv7fjuP,ucH+(填自己的密码) ALTER USER "root"@"localhost" IDENTIFIED BY "自己的密码"; FLUSH PRIVILEGES; #立即生效 |
再次用户root 用户登录 输入自己刚刚修改的密码就可以了
11 远程连接
1
2
3
4
|
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 ) |
连接成功
参考文章
http://www.zzvips.com/article/118464.html
http://www.zzvips.com/article/6327.html
总结
以上所述是小编给大家介绍的linux(Centos7)下安装mysql8.0.18的教程图解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
原文链接:https://blog.csdn.net/jessDL/article/details/103228376