1:新建目录:
2:下载Mysql数据库文件:
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar:
3:安装数据库文件
解压文件
tar -xvf mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar
yum -y install mysql-comm*.rpm
按照过程中发现包冲突,由于是新装的系统,故卸载掉相关包,重新安装
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-connector-c-3.1.11-2.oc8.1.x86_64
rpm -e --nodeps mariadb-connector-c-config-3.1.11-2.oc8.1.noarch
再次执行安装
yum -y install mysql-comm*.rpm
安装成功
[root@VM-4-14-opencloudos mysql]# yum -y install mysql-comm*.rpm Last metadata expiration check: 0:11:16 ago on Mon 24 Jul 2023 04:34:33 PM CST. Dependencies resolved. ================================================================================================================================================================================ Package Architecture Version Repository Size ================================================================================================================================================================================ Installing: mysql-community-client x86_64 5.7.39-1.el7 @commandline 28 M mysql-community-common x86_64 5.7.39-1.el7 @commandline 311 k mysql-community-devel x86_64 5.7.39-1.el7 @commandline 4.2 M mysql-community-embedded x86_64 5.7.39-1.el7 @commandline 46 M mysql-community-embedded-compat x86_64 5.7.39-1.el7 @commandline 22 M mysql-community-embedded-devel x86_64 5.7.39-1.el7 @commandline 127 M mysql-community-libs x86_64 5.7.39-1.el7 @commandline 2.6 M mysql-community-libs-compat x86_64 5.7.39-1.el7 @commandline 1.2 M mysql-community-server x86_64 5.7.39-1.el7 @commandline 178 M mysql-community-test x86_64 5.7.39-1.el7 @commandline 121 M Installing dependencies: compat-openssl10 x86_64 1:1.0.2o-4.oc8 AppStream 1.1 M ncurses-compat-libs x86_64 6.1-9.20180224.oc8 BaseOS 327 k perl-JSON noarch 2.97.001-2.oc8 AppStream 95 k Transaction Summary ================================================================================================================================================================================ Install 13 Packages Total size: 532 M Installed size: 2.7 G Downloading Packages: [SKIPPED] ncurses-compat-libs-6.1-9.20180224.oc8.x86_64.rpm: Already downloaded [SKIPPED] compat-openssl10-1.0.2o-4.oc8.x86_64.rpm: Already downloaded [SKIPPED] perl-JSON-2.97.001-2.oc8.noarch.rpm: Already downloaded Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : mysql-community-common-5.7.39-1.el7.x86_64 1/13 Installing : mysql-community-libs-5.7.39-1.el7.x86_64 2/13 Running scriptlet: mysql-community-libs-5.7.39-1.el7.x86_64 2/13 Installing : compat-openssl10-1:1.0.2o-4.oc8.x86_64 3/13 Running scriptlet: compat-openssl10-1:1.0.2o-4.oc8.x86_64 3/13 Installing : mysql-community-devel-5.7.39-1.el7.x86_64 4/13 Installing : mysql-community-embedded-5.7.39-1.el7.x86_64 5/13 Running scriptlet: mysql-community-embedded-5.7.39-1.el7.x86_64 5/13 Installing : perl-JSON-2.97.001-2.oc8.noarch 6/13 Installing : ncurses-compat-libs-6.1-9.20180224.oc8.x86_64 7/13 Installing : mysql-community-client-5.7.39-1.el7.x86_64 8/13 Running scriptlet: mysql-community-server-5.7.39-1.el7.x86_64 9/13 Installing : mysql-community-server-5.7.39-1.el7.x86_64 9/13 Running scriptlet: mysql-community-server-5.7.39-1.el7.x86_64 9/13 Installing : mysql-community-test-5.7.39-1.el7.x86_64 10/13 Installing : mysql-community-embedded-devel-5.7.39-1.el7.x86_64 11/13 Installing : mysql-community-embedded-compat-5.7.39-1.el7.x86_64 12/13 Installing : mysql-community-libs-compat-5.7.39-1.el7.x86_64 13/13 Running scriptlet: mysql-community-libs-compat-5.7.39-1.el7.x86_64 13/13 [/usr/lib/tmpfiles.d/mysql.conf:23] Line references path below legacy directory /var/run/, updating /var/run/mysqld → /run/mysqld; please update the tmpfiles.d/ drop-in file accordingly. Verifying : ncurses-compat-libs-6.1-9.20180224.oc8.x86_64 1/13 Verifying : compat-openssl10-1:1.0.2o-4.oc8.x86_64 2/13 Verifying : perl-JSON-2.97.001-2.oc8.noarch 3/13 Verifying : mysql-community-client-5.7.39-1.el7.x86_64 4/13 Verifying : mysql-community-common-5.7.39-1.el7.x86_64 5/13 Verifying : mysql-community-devel-5.7.39-1.el7.x86_64 6/13 Verifying : mysql-community-embedded-5.7.39-1.el7.x86_64 7/13 Verifying : mysql-community-embedded-compat-5.7.39-1.el7.x86_64 8/13 Verifying : mysql-community-embedded-devel-5.7.39-1.el7.x86_64 9/13 Verifying : mysql-community-libs-5.7.39-1.el7.x86_64 10/13 Verifying : mysql-community-libs-compat-5.7.39-1.el7.x86_64 11/13 Verifying : mysql-community-server-5.7.39-1.el7.x86_64 12/13 Verifying : mysql-community-test-5.7.39-1.el7.x86_64 13/13 Installed: compat-openssl10-1:1.0.2o-4.oc8.x86_64 mysql-community-client-5.7.39-1.el7.x86_64 mysql-community-common-5.7.39-1.el7.x86_64 mysql-community-devel-5.7.39-1.el7.x86_64 mysql-community-embedded-5.7.39-1.el7.x86_64 mysql-community-embedded-compat-5.7.39-1.el7.x86_64 mysql-community-embedded-devel-5.7.39-1.el7.x86_64 mysql-community-libs-5.7.39-1.el7.x86_64 mysql-community-libs-compat-5.7.39-1.el7.x86_64 mysql-community-server-5.7.39-1.el7.x86_64 mysql-community-test-5.7.39-1.el7.x86_64 ncurses-compat-libs-6.1-9.20180224.oc8.x86_64 perl-JSON-2.97.001-2.oc8.noarch Complete! [root@VM-4-14-opencloudos mysql]#
执行mysql重启
systemctl restart mysqld.service systemctl start mysqld.service systemctl stop mysqld.service
查询启动过程的随机密码
cat /var/log/mysqld.log | grep 'temporary password is generated'
重置密码:
登录Mysql
mysql -uroot -p ALTER USER 'root'@'localhost' IDENTIFIED BY '123456@abcAbc';
由于上述密码策略不能设置简单的密码,故设置复杂的,开发及测试环境想要容易记得点,故设置简单的密码
修改密码后,查询密码策略等级
show variables like 'validate%';
SET GLOBAL validate_password_policy=LOW set global validate_password_length = 6
设置远程登录MySQL
允许root用户在任何地方进行远程登录,并具有所有库任何操作权限;
GRANT ALL PRIVILEGES ON *.* TO '你的账户'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION; flush privileges;
如果无法本地登录,可以查看防火墙或者ACL访问控制是否限制了端口
Linux防火墙
firewall-cmd --state systemctl stop firewalld.service systemctl start firewalld.service systemctl disable firewalld.service systemctl enable firewalld.service
云服务器ACL配置:
测试联通并访问成功:
标签:02,39,x86,5.7,mysql,64,Linux,el7 From: https://www.cnblogs.com/lewisat/p/17577734.html