本篇内容主要讲解“Mysql5.7怎么在OL 6上以RPM包安装”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Mysql5.7怎么在OL 6上以RPM包安装”吧!
系统:OL 6 X64
DB:Mysql 5.7
准备以下安装介质:mysql-5.7.25-1.el6.x86_64.rpm-bundle.tar,以及部分perl包,解压tar包,得到以下:
[root@mysql1 ~]# ll mysql
total 465340
-rwxr-xr-x. 1 root root 851 Mar 25 22:21 install-mysql.sh
-rw-r--r--. 1 7155 31415 23853144 Dec 24 13:42 mysql-community-client-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 340184 Dec 24 13:42 mysql-community-common-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 3797584 Dec 24 13:42 mysql-community-devel-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 39489784 Dec 24 13:42 mysql-community-embedded-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 137670944 Dec 24 13:42 mysql-community-embedded-devel-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 2203408 Dec 24 13:42 mysql-community-libs-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 1723740 Dec 24 13:42 mysql-community-libs-compat-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 160646088 Dec 24 13:42 mysql-community-server-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 106159460 Dec 24 13:43 mysql-community-test-5.7.25-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 86764 Mar 25 22:10 perl-JSON-2.50-1.el6.rfx.noarch.rpm
-rw-r--r--. 1 root root 303212 Mar 25 22:10 perl-Test-Harness-3.23-1.el6.rfx.noarch.rpm
-rw-r--r--. 1 root root 121376 Mar 25 22:10 perl-Test-Simple-0.98-1.el6.rfx.noarch.rpm
-rw-r--r--. 1 root root 73972 Mar 25 22:10 perl-Time-HiRes-1.9724-1.el6.rfx.x86_64.rpm
运行以下脚本安装:
#!/bin/bash
yum -y remove mysql-libs
rpm -ivh mysql-community-common-5.7.25-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.25-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.25-1.el6.x86_64.rpm
#yum -y install perl-Getopt-Long
rpm -ivh mysql-community-server-5.7.25-1.el6.x86_64.rpm
#yum -y install perl-Data-Dumper
#yum -y install perl-JSON
rpm -ivh perl-Test-Harness-3.23-1.el6.rfx.noarch.rpm
rpm -ivh perl-Test-Simple-0.98-1.el6.rfx.noarch.rpm
rpm -ivh perl-Time-HiRes-1.9724-1.el6.rfx.x86_64.rpm
rpm -ivh perl-JSON-2.50-1.el6.rfx.noarch.rpm
rpm -ivh mysql-community-test-5.7.25-1.el6.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.25-1.el6.x86_64.rpm
rpm -ivh mysql-community-embedded-5.7.25-1.el6.x86_64.rpm
rpm -ivh mysql-community-embedded-devel-5.7.25-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.25-1.el6.x86_64.rpm
安装完成后,会自动得到/etc/my.cnf以及mysql系统用户。
运行mysql:
service mysqld start
启动后会生成一个临时密码,找出该临时密码:
[root@mysql1 ~]# grep 'temporary password' /var/log/mysqld.log
2019-03-25T14:39:17.363300Z 1 [Note] A temporary password is generated for root@localhost: Pdp7#a!w0;or
以该临时密码登入mysql,随后更改密码
[root@mysql1 ~]# mysql -uroot -p
Enter password:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql1';
Query OK, 0 rows affected (0.01 sec)
到此,相信大家对“Mysql5.7怎么在OL 6上以RPM包安装”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!