# CentOS 安装MYSQL **Published by:** [nightelfamber](https://paragraph.com/@nightelfamber/) **Published on:** 2022-01-26 **URL:** https://paragraph.com/@nightelfamber/centos-mysql ## Content 查看Linux 版本uname -a Linux iZ2ze9foeig0mb0yaofw8iZ 4.19.91-24.1.al7.x86_64 #1 SMP Wed Jul 21 17:40:23 CST 2021 x86_64 x86_64 x86_64 GNU/Linux 下载mysql源wget https://repo.mysql.com//mysql80-community-release-el7-5.noarch.rpm 安装mysql源yum -y install mysql80-community-release-el7-5.noarch.rpm 查看一下安装效果yum repolist enabled | grep mysql.* mysql源用yum命令直接安装yum install mysql-community-server -y 阿里云的基本会安装成功启动mysql服务systemctl start mysqld.service 查看服务运行状况run-status初始化数据库查看初始密码grep "password" /var/log/mysqld.log passwd登录mysql -uroot -p 修改密码ALTER USER 'root'@'localhost' IDENTIFIED BY '****************'; 支持远程登录mysql -uroot -p use mysql; update user set host = '%' where user = 'root'; select host, user from user; result自动启动systemctl enable mysqld systemctl daemon-reload ## Publication Information - [nightelfamber](https://paragraph.com/@nightelfamber/): Publication homepage - [All Posts](https://paragraph.com/@nightelfamber/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@nightelfamber): Subscribe to updates - [Twitter](https://twitter.com/Stars587): Follow on Twitter