阿里云centOS8安装mysql
一、删除以前安装的mysql或者Mariadb
rpm -qa|grep mariadb
//查看安装的mariadb
mariadb-common-10.3.27-3.module_el8.3.0+599+c587b2e7.x86_64
mariadb-errmsg-10.3.27-3.module_el8.3.0+599+c587b2e7.x86_64
mariadb-connector-c-config-3.1.11-2.el8_3.noarch
mariadb-connector-c-3.1.11-2.el8_3.x86_64
//删除它们
rpm -e --nodeps mariadb-common-10.3.27-3.module_el8.3.0+599+c587b2e7.x86_64
rpm -e --nodeps mariadb-errmsg-10.3.27-3.module_el8.3.0+599+c587b2e7.x86_64
rpm -e --nodeps mariadb-connector-c-config-3.1.11-2.el8_3.noarch
rpm -e --nodeps mariadb-connector-c-3.1.11-2.el8_3.x86_64
同理删除mysql
rpm -qa|grep mysql
rpm -e --nodeps+文件名
二、 接下来删除/var/lib/mysql文件夹里面的内容:
rm -rf /var/lib/mysql
三、查看安装步骤
https://blog.csdn.net/qq_21275565/article/details/106747830
四、解决navicat连接报错1251
//先进入mysql
use mysql;
SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 8 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | MEDIUM |
| validate_password.special_char_count | 1 |
+--------------------------------------+--------+
//修改密码强度等级
//不然直接替换密码可能会报错
set global validate_password.policy =LOW;
//注意这里是'%'不是localhost
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
//查看自己的是什么
select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
//刷新权限
FLUSH PRIVILEGES;
//退出mysql
exit
五、Navicat远程连接阿里云数据库成功!
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/4d6ac159c4525a8216e7b8ebc166cfbe.png#pic_center)