Centos8安装mysql rpm 安装

rpm包安装

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar

tar xvf mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar

安装依赖

yum install libncurses*

yum install perl

#一般依次安装以下包即可

rpm -ivh mysql-community-common-5.7.34-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.34-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-5.7.34-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-5.7.34-1.el7.x86_64.rpm

查看mysql服务状态

systemctl status mysqld

[root@centos7 mysql-5.34]# systemctl status mysqld

Failed to get properties: Access denied

解决方案

centos - systemctl access denied when root - Super User

However according to the init manpage, you can do the same thing by sending SIGTERM to the daemon running as PID 1, which worked:

kill -TERM 1

This reloaded the daemon, after which all the systemctl commands started working again.

● mysqld.service - MySQL Server

Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

Active: inactive (dead)

Docs: man:mysqld(8)

http://dev.mysql.com/doc/refman/en/using-systemd.html

启动

 systemctl start mysqld

mysql从5.7默认安装之后root是有密码的,为了加强安全性,mysql5.7为root用户随机生成一个密码,它在error log中。

还有,mysql只有启动过一次才可以查看临时密码。

注意:如果是rpm包安装的mysql,则默认是/var/log/mysqld.log

grep 'temporary password' /var/log/mysqld.log

登陆

mysql -uroot -p

输入刚才查到的密码

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssW0rd';

show databases;

参考

https://blog.csdn.net/qq_36713450/article/details/123315752

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值