1.下载镜像
yum install wget
wgethttps://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
2.安装镜像
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
3.升级系统中的软件包
yum update mysql-server
4.安装mysql
yum -y install mysql-server
提示:
失败的软件包是:mysql-community-icu-data-files-8.0.30-1.el7.x86_64GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
重新导入密钥并执行安装
rpm --importhttps://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum -y install mysql-server
安装完毕
5.修改文件权限
chown mysql:mysql -R /var/lib/mysql
6.初始化
mysqld --initialize
7.启动设置开机自启动
systemctl start mysqld.service
systemctl enable mysqld.service
systemctl daemon-reload
看到active状态表示正常
8.查看版本
mysqladmin --version
9.进入mysql
mysql -u root -p
权限错误
10.重置密码
#关闭服务
systemctl stop mysqld
#跳过检查方式启动
mysqld --user=root --skip-grant-tables &
#登录mysql
mysql -u root -p
#刷新权限
flush privileges;
#修改密码
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码';
11.开启mysql远程
#登录
mysql -u root -p 你的密码
#查询数据库的用户
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
#更新用户表
UPDATE user SET `Host`='%' WHERE `User`='root' LIMIT 1;
alter user 'root'@'%' identified with mysql_native_password by 'ok';
#刷新权限
flush privileges;
12.使用Navicat测试连接
13.初始化hive元数据
cd /data/soft/apache-hive-3.1.2-bin/bin
schematool -dbType mysql -initSchema