Bootstrap

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

;