💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。
- 推荐:kwan 的首页,持续学习,不断总结,共同进步,活到老学到老
- 导航
- 檀越剑指大厂系列:全面总结 java 核心技术点,如集合,jvm,并发编程 redis,kafka,Spring,微服务,Netty 等
- 常用开发工具系列:罗列常用的开发工具,如 IDEA,Mac,Alfred,electerm,Git,typora,apifox 等
- 数据库系列:详细总结了常用数据库 mysql 技术点,以及工作中遇到的 mysql 问题等
- 懒人运维系列:总结好用的命令,解放双手不香吗?能用一个命令完成绝不用两个操作
- 数据结构与算法系列:总结数据结构和算法,不同类型针对性训练,提升编程思维,剑指大厂
非常期待和您一起在这个小小的网络世界里共同探索、学习和成长。💝💝💝 ✨✨ 欢迎订阅本专栏 ✨✨
rpm -qa | grep -i mysql
#查看mysql的状态 systemctl status mysqld #关闭mysql systemctl stop mysqld
find / -name mysql
MySQL-server-5.6.22-1.el6.i686 为步骤 1 中查询到的数据项
rpm -ev MySQL-server-5.6.22-1.el6.i686 rpm -ev MySQL-client-5.6.22-1.el6.i686
/etc/selinux/targeted/active/modules/100/mysql 为步骤 3 中查询到的文件
rm -rf /etc/selinux/targeted/active/modules/100/mysql rm -rf /var/selinux/targeted/active/modules/100/mysql rm -rf /var/lib/selinux/targeted/active/modules/100/mysql rm -rf /var/lib/mysql rm -rf /usr/lib/mysql rm -rf /usr/share/bash-completion/completions/mysql rm -rf /usr/share/selinux/targeted/default/active/modules/100/mysql rm -rf /usr/local/mysql
#查询mariadb rpm -qa | grep mariadb #强制卸载 rpm -e --nodeps 查询到的mariadb
下载地址
下载 rpm 包时要认清对应的系统版本,el7 代表的是 Linux 7 版本,依次类推。
如何查看linux系统该下哪个包呢?
#查看系统 cat /etc/redhat-release cat /etc/os-release uname -a cat /proc/version
CentOS Linux release 7.x.x (Core)
#显示包含发行版 cat /etc/redhat-release #显示包含各种系统信息 cat /etc/os-release #显示系统信息 uname -a #内核版本和编译信息 cat /proc/version
这四个命令用于查看 Linux 系统的版本信息,但它们获取信息的方式和提供的详细信息略有不同:
cat /etc/redhat-release:
cat /etc/os-release:
uname -a:
cat /proc/version:
综合来说,这些命令提供了有关系统版本和内核的不同方面的信息。选择使用其中一个取决于你关心的具体信息以及你正在使用的 Linux 发行版。
mysql-community-common-8.0.35-1.el7.x86_64.rpm mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm mysql-community-libs-8.0.35-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm mysql-community-client-8.0.35-1.el7.x86_64.rpm mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm mysql-community-server-8.0.35-1.el7.x86_64.rpm
将文件上传到服务器的/kwan/software/mysql 目录下
scp /Users/qinyingjie/Downloads/mysql/mysql-community-client-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql scp /Users/qinyingjie/Downloads/mysql/mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql scp /Users/qinyingjie/Downloads/mysql/mysql-community-common-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql scp /Users/qinyingjie/Downloads/mysql/mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql scp /Users/qinyingjie/Downloads/mysql/mysql-community-libs-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql scp /Users/qinyingjie/Downloads/mysql/mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql scp /Users/qinyingjie/Downloads/mysql/mysql-community-server-8.0.35-1.el7.x86_64.rpm root@43.139.90.182:/kwan/software/mysql
# 进入mysql的目录 cd /kwan/software/mysql
#按如下顺序安装需要的包 rpm -ivh mysql-community-common-8.0.35-1.el7.x86_64.rpm rpm -ivh mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-8.0.35-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm rpm -ivh mysql-community-client-8.0.35-1.el7.x86_64.rpm rpm -ivh mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm rpm -ivh mysql-community-server-8.0.35-1.el7.x86_64.rpm
[root@localhost mysql_rpm]# rpm -ivh mysql-community-libs-8.0.31-1.el7.x86_64.rpm
警告:mysql-community-libs-8.0.31-1.el7.x86_64.rpm: 头 V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
错误:依赖检测失败:
mariadb-libs 被 mysql-community-libs-8.0.31-1.el7.x86_64 取代
解决方案
rpm -qa | grep mariadb rpm -e mariadb-libs-5.5.68-1.el7.x86_64 rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
mysqld --initialize --user=mysql
cat /var/log/mysqld.log
[root@localhost ~]# cat /var/log/mysqld.log
2023-02-03T06:55:54.523261Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 41643
2023-02-03T06:55:54.552161Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-02-03T06:55:55.517362Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-02-03T06:55:57.053474Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: er:ExOzaI1b.
er:ExOzaI1b.就是随机生成的密码,先记下来后面会用到。
#启动服务 systemctl start mysqld
#状态查看 systemctl status mysqld
#停止mysql服务 systemctl stop mysqld
#重启mysql服务 systemctl restart mysqld
#使用刚记下来的密码 mysql -uroot -p
#查看库 show databases; #选定库 use mysql;
select host, user, plugin, authentication_string, password_expired from user;
#更新root用户的信息 update user set host='%' where user='root';
#更新root用户的权限 ALTER USER root@'%' IDENTIFIED WITH mysql_native_password BY '15671628341qyj.';
#刷新权限 FLUSH PRIVILEGES; #退出 exit
使用 dbeaver 进行连接验证
# 输出8.0.27 SELECT VERSION()
Mysql Access denied for user ‘root‘@ ‘…‘ (using password: YES)异常处理
解决办法
#登录 mysql -u root -p #查看库 show databases; #选定库 use mysql; select host, user, plugin, authentication_string, password_expired from user; #更新root用户的信息 update user set host='%' where user='root'; #更新root用户的权限 ALTER USER root@'%' IDENTIFIED WITH mysql_native_password BY '15671628341qyj.'; #刷新权限 FLUSH PRIVILEGES; #退出客户端 exit
觉得有用的话点个赞 👍🏻 呗。
❤️❤️❤️本人水平有限,如有纰漏,欢迎各位大佬评论批评指正!😄😄😄
💘💘💘如果觉得这篇文对你有帮助的话,也请给个点赞、收藏下吧,非常感谢!👍 👍 👍
🔥🔥🔥Stay Hungry Stay Foolish 道阻且长,行则将至,让我们一起加油吧!🌙🌙🌙