MySQL 是一个流行的开源关系型数据库管理系统,它是由瑞典 MySQL AB 公司创建的,之后被 Sun Microsystems 收购,现在是 Oracle 公司的一部分。MySQL 使用了多种不同的编程语言(包括 C、C++、Python 和 PHP)进行开发,它被广泛用于网站开发和其他应用程序中。MySQL 以其高性能、可靠性和易用性而闻名,并且可以在 Linux、Unix 和 Windows 等多个操作系统上运行。
- cat > /etc/yum.repos.d/mysql-community.repo << EOF
- [mysql-connectors-community]
- name=MySQL Connectors Community
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7-\$basearch/
- enabled=1
- gpgcheck=1
- gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
-
- [mysql-tools-community]
- name=MySQL Tools Community
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-tools-community-el7-\$basearch/
- enabled=1
- gpgcheck=1
- gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
-
- [mysql-8.0-community]
- name=MySQL 8.0 Community Server
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-\$basearch/
- enabled=1
- gpgcheck=1
- gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
- EOF
重新导入 MySQL 8.0 Community Server 的 GPG 密钥
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum install mysql-community-server
systemctl start mysqld
grep 'password' /var/log/mysqld.log
输入密码
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPwd520@';
注意:密码至少要有一个大写字母,一个小写字母,一个数字,一个特殊符号,并且长度至少为八位。
- use mysql;
- update user set Host = '%' where Host = 'localhost' and User='root';
- flush privileges;
