CentOS7上rpm安装MySQL8

1.下载
安装包下载链接

https://downloads.mysql.com/archives/community/

或者在MySQL官网根据提示一步一步点进去




选择合适的版本

2.上传至服务器,解压

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

3.安装
参考官方文档

https://dev.mysql.com/doc/refman/8.0/en/linux-installation-rpm.html


安装命令

yum install mysql-community-{server,client,client-plugins,icu-data-files,common,libs}-*

4.启动

systemctl start mysqld

首次启动后,在/var/log/mysqld.log日志文件中可以找到root用户的初始化密码

grep 'temporary password' /var/log/mysqld.log
2024-09-05T04:56:55.951789Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ga7u#(itCpx<

登录并修改密码

mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourPassword';

默认root用户不允许远程登录,修改为允许远程登录

use mysql
UPDATE user SET host='%' WHERE user='root';
flush privileges;


远程连接

posted @ 2024-09-09 17:58  年迈的魔法师  阅读(65)  评论(0编辑  收藏  举报