查看系统中是否已安装 MySQL 服务
yum list installed | grep mysql
下载 mysql57的 yum 源
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
查看下载
ll
安装源
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
安装 MySQL
yum install mysql-server
yum install mysql-server --nodeps
一堆满满安装
启动mysql
service mysqld start
查看mysql启动
ps -ef | grep mysql
查看初始化密码
grep "password" /var/log/mysqld.log
登录到 MySQL 服务端
mysql -u root -p
更新用户 root 的密码
SET PASSWORD = PASSWORD('chengxuyuan');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;
设置用户 root 可以在任意 IP 下被访问
grant all privileges on *.* to root@"%" identified by "chengxuyuan";
刷新权限
MySQL控制命令
- 启动 :service mysqld start
- 停止:service mysqld stop
- 重启:service mysqld restart
- 查看状态:service mysqld status
问题1:源 "MySQL 5.7 Community Server" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
总计:220 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-libs-5.7.44-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
源 "MySQL 5.7 Community Server" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
失败的软件包是:mysql-community-libs-5.7.44-1.el7.x86_64
GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
执行命令
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022