MySQL安装
- 相关安装包下载
- 1、安装前准备
- 1.1检查是否已安装
- 1.2清理mariadb
- 2、安装依赖
- 3、修改操作系统限制
- 4、解压并安装
- 5、查看安装状态并启动
- 6、查看临时密码
- 7、登入数据库并修改密码
- 8、授权远程连接
- 9、Navicat连接测试
相关安装包下载
链接:https://pan.baidu.com/s/1RuOtncFkBOPNrcBGRxaIJg?pwd=1h8h
提取码:1h8h
1、安装前准备
1.1检查是否已安装
rpm -qa |grep mysql #检查是否已安装
rpm -qa |grep mariadb #系统默认自带
1.2清理mariadb
rpm -e mariadb-libs-5.5.68-1.el7.x86_64
报依赖错误则使用以下命令
yum remove mariadb-libs-5.5.68-1.el7.x86_64
2、安装依赖
yum install libaio #需安装
yum install perl #一般已安装
yum install net-tools #一般已安装
3、修改操作系统限制
cat <<'EOF'>> /etc/security/limits.conf
* soft nproc 65536
* hard nproc 65536
* soft nofile 65536
* hard nofile 65536
EOF
4、解压并安装
tar -xzvf mysql-8.0.25-1.el7.x86_64.rpm-bundle.tar
进入mysql解压后的目录
rpm -ivh mysql-community* --force --nodeps
5、查看安装状态并启动
systemctl status mysqld
systemctl start mysqld
6、查看临时密码
grep password /var/log/mysqld.log #查看临时密码
7、登入数据库并修改密码
修改密码文章来源:https://uudwc.com/A/jV2x9
alter user 'root'@'localhost' identified by 'password'; #不能太简单
8、授权远程连接
use mysql;
select host, user, authentication_string, plugin from user; #查看当前信息
update user set host='%' where user='root'; #更改root的host为%
select host, user, authentication_string, plugin from user;
flush privileges;
9、Navicat连接测试
关闭linux防火墙或添加防火墙策略,使用navicat进行连接测试,如果远程连接报错如下
Error: 1251
Message: Client does not support authentication protocol requested by server; consider upgrading MySQL client
进入数据库运行以下命令文章来源地址https://uudwc.com/A/jV2x9
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';