MySQL
安装
mkdir /app/mysql && cd /app/mysqlyum -y updatewget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpmsudo yum localinstall mysql80-community-release-el7-3.noarch.rpm -ysudo yum install -y yum-utilsyum repolist enabled | grep "mysql.*-community.*"yum repolist all | grep mysqlsudo yum-config-manager --disable mysql80-communitysudo yum-config-manager --enable mysql57-communityyum repolist enabled | grep mysqlsudo yum install -y mysql-community-serversudo yum install -y mysql-community-server --nogpgcheckrpm --checksig /var/cache/yum/x86_64/7/mysql80-community/packages/mysql80-community-release-el7-11.noarch.rpm[root@localhost postgresql]# rpm --checksig /var/cache/yum/x86_64/7/mysql80-community/packages/mysql80-community-release-el7-11.noarch.rpm /var/cache/yum/x86_64/7/mysql80-community/packages/mysql80-community-release-el7-11.noarch.rpm: RSA sha1 (MD5) PGP md5 不正确rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022[root@localhost postgresql]# rpm --checksig /var/cache/yum/x86_64/7/mysql80-community/packages/mysql80-community-release-el7-11.noarch.rpm /var/cache/yum/x86_64/7/mysql80-community/packages/mysql80-community-release-el7-11.noarch.rpm: rsa sha1 (md5) pgp md5 确定sudo service mysqld startsudo service mysqld statusRedirecting to /bin/systemctl status mysqld.service ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2025-03-11 18:01:29 CST; 40s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 21449 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 21550 (mysqld) Status: "Server is operational" CGroup: /system.slice/mysqld.service └─21550 /usr/sbin/mysqld Mar 11 18:01:22 VM-8-17-centos systemd[1]: Starting MySQL Server... Mar 11 18:01:29 VM-8-17-centos systemd[1]: Started MySQL Server.systemctl enable mysqldsudo grep 'temporary password' /var/log/mysqld.log2025-03-11T10:01:24.744631Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: .,.LE5psXu6Emysql -u root -pALTER USER 'root'@'localhost' IDENTIFIED BY '我的密码';use mysql;update user set host='%' where user='root';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON *.* TO 'root'@'特定IP' WITH GRANT OPTION;FLUSH PRIVILEGES;quitfirewall-cmd --zone=public --add-port=3306/tcp --permanent systemctl restart firewalld
最后更新于
这有帮助吗?