当前位置:网站首页>【阿里云服务器-安装mysql的5.6版本安装,重装】
【阿里云服务器-安装mysql的5.6版本安装,重装】
2022-06-22 15:27:00 【麦子粒粒】
1.旧版本删除
1.1 查看mysql相关的数据
rpm -qa|grep -i mysql

1.2 删除数据
注意:.noarch文件不删除,无法重新安装
rpm -ev mysql-community-release-el7-5.noarch

yum remove mysql-community mysql-community-server mysql-community-libs mysql-community-common
遇到选择输入y
删除成功时 rpm -qa|grep -i mysql 命令无返回结果
查看有关mysql安装的所有目录
find / -name mysql

依次删掉
rm -rf /var/lib/mysql/
删除mysql的配置及初始密码的配置,注意这一步不执行,会导致重装的密码错误,无法正常进入mysql
rm -rf /etc/my.cnf
rm -rf /root/.mysql_sercret
2. mysql 5.6 版本安装
注意:5.6版本不支持json的数据类型,5.7新增的支持json类型
# 给下载的mysql创建一个文件夹
mkdir mysql5.6
# 下载安装包
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
# 安装mysql,遇到Is this ok [y/d/N]: y,输入y回车
yum localinstall mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
# 启动MySQL服务
systemctl restart mysqld
# 设置开启启动mysql服务
systemctl enable mysqld
# 查看MySQL初始密码
grep 'A temporary password' /var/log/mysqld.log
# 注意5.6 安装后是没有密码的,因为重装会出现密码,输入会提示密码不正确,不需要输入密码,直接回车即可
mysql -u root -p
# 修改密码
set password for 'root'@'localhost'=password('你的密码');
# 设置Navicat,mysql能够远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
3. mysql 5.7 版本安装
注意:5.7.10版本密码要求上升
# 下载
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
# 安装
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
安装mysql服务报错时
MySQL的GPG升级了,需要更新,如果是新安装的MySQL,执行以下脚本即可
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
# 重新执行安装mysql服务命令
yum -y install mysql-community-server
启动mysql
systemctl start mysqld.service
# 查看mysql状态
systemctl status mysqld.service
登录数据库
# 获取临时密码,若结果为多个,选择最后一个
grep 'temporary password' /var/log/mysqld.log
# 登录数据库
mysql -u root -p
# 修改密码
set password for 'root'@'localhost'=password('你的密码');
# 设置Navicat,mysql能够远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
若输入的密码被认为太简单
先设计为符合要求的密码,然后执行一下命令后,重新修改密码为最初想要的
use mysql;
# 查看密码强度
SHOW VARIABLES LIKE 'validate_password%';

密码安全等级为MEDIUM,等级改为LOW
set global validate_password_policy=LOW;
参考连接
如何在阿里云服务器(centos7)安装、卸载mysql数据库
测试N次,阿里云centos7安装mysql5.7,看完这篇一次过!
阿里云官方的操作手册
边栏推荐
- win10的wifi断线后无法连接
- Unable to connect after win10 WiFi is disconnected
- vs2017 在调试状态不显示QString值的解决方法
- nio文件和文件夹操作例子
- Spark's NaiveBayes Chinese text classification
- Implementing factory mode using enumeration
- What is SAP ABAP? Type, ABAP full form and meaning
- 购买指南丨如何购买一台高质量会议平板,这几个方面一定要对比
- Safari兼容性问题总结
- JS method for judging data type of interview questions
猜你喜欢

Special research on Intelligent upgrading of heavy trucks in China in 2022

Shell learning

linux系统维护篇:mysql8.0.13源码下载及安装之“傻瓜式”操作步骤(linux-centos6.8)亲测可用系列

【C语言】库函数qsort的使用

What is SAP ABAP? Type, ABAP full form and meaning

Windows8.1 64 installed by mysql5.7.27
![Consumption monitoring of Prometheus monitoring [consult exporter]](/img/9e/8547b2c38143ab0e051c1cf0b04986.png)
Consumption monitoring of Prometheus monitoring [consult exporter]

【微信小程序封装底部弹出框】一
![[pop up box 2 at the bottom of wechat applet package]](/img/31/266e6a1f4200347c9324ea37b78562.png)
[pop up box 2 at the bottom of wechat applet package]

让代码优雅起来(学会调试+代码风格)
随机推荐
接口(优化类型注解)
[pop up box 2 at the bottom of wechat applet package]
招行23型号UKey在win7上无法识别
What should I do if I can't hear a sound during a video conference?
JSP learning (2) -- JSP script elements and instructions
Vs2017 solution to not displaying qstring value in debugging status
从Application提交角度审视Executor
Analysis of the writer source code of spark shuffle
Smart forms-014 in SAP ABAP
Summary of JS methods for obtaining data types
论催收系统的任务调度设计
spark-shuffle的写入器源码分析
The world's "first" IEEE privacy computing "connectivity" international standard led by insight technology was officially launched
[C language] deeply analyze the storage of integer and floating-point types in memory
CUMT学习日记——数字图像处理考试速成笔记
How to add a "security lock" to the mobile office of government and enterprises?
Test for API
面试知识点
spark关于数据倾斜问题
SAP ABAP sub screen tutorial: call sub screen -010 in SAP