rhel5u盘安装 (rhel u盘安装) 1 下载

下载链接

https://dev.mysql.com/downloads/mysql/

确认linux对应的版本:

cat /proc/version

uname -a

lsb_release -a

cat /etc/redhat-release

cat 电脑/etc/issue



这个是内核的版本:

3.10.0-1062.9.1.el7.x86_64

选择操作系统版本:





2.解电脑 压mysql的tar格式文件

 tar -xvf mysql-8.0.20-1.el7.x86_64.rpm-bundle.tar

运行上述命令,得到如下结果,有8个文件包:


也可以创建一个文件夹,在同一个子目录下解压。

3.安装解压的rpm安装包

然后我们可以用rpm -ivh命令来进行安装,注意安装顺序,因为这些包的安装是相互依赖的:

必须安装(注意顺序)

rpm -ivh mysql-community-common-8.0.20-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-8.0.20-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-8.0.20-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-8.0.20-1.el7.x86_64.rpm

非必要安装(注意顺序)

rpm -ivh mysql-community-libs-compat-8.0.20-1.el7.x86_64.rpm

rpm -ivh mysql-community-embedded-compat-8.0.20-1.el7.x86_64.rpm

rpm -ivh mysql-community-devel-8.0.20-1.el7.x86_64.rpm

rpm -ivh mysql-community-test-8.0.20-1.el7.x86_64.电脑rpm

安装过程中可能会报以下错误:

出现问题:error:

Failed dependencies:

libnuma.so.1()(64bit) is needed by mysql-community-server-8.0.13-1.el7.x86_64 libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-8.0.13-1.el7.x86_64 libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-8.0.13-1.el7.x86_64

解决办法:

yum install numactl

出现问题:error:

Failed dependencies:pkgconfig(openssl) is needed by mysql-community-devel-8.0.13-1.el7.x86_64

解决办法:

yum install openssl-devel.x86_64 openssl.x86_64 -y

出现问题:error:

Failed dependencies:perl(Data::Dumper) is needed by mysql-community-test-8.0.13-1.el7.x86_64

解决办法:

yum -y install autoconf

出现问题:error:

Failed dependencies:perl(JSON) is needed by mysql-community-test-8.0.13-1.el7.x86_64

解决办法:

yum install perl.x86_64 perl-devel.x86_64 -y

yum install perl-JSON.noarch -y

出现问题:error:

error: Failed dependencies:libaio.so.1()(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64libaio.so.1电脑(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64

libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64

解决办法:

yum install libaio

以上我们的MySQL就安装好了,下面可以直接使用了。

4.使用数据库初始化数据库

mysqld --initialize --console

目录授权,不授权的话MySQL没有写入权限,会启动失败

所以在初始化之前,记得授权,命令为:chown -R mysql:mysql /var/lib/mysql/

启动msyql服务

命令:systemctl start mysqld

停止MySQL命令:

service mysqld stop

查看msyql服务的状态

service mysqld status


电脑

当看到Active后面是active(runing)说明启动成功了

4.修改数据库密码

当我们输入mysql -u root -p需要输入密码,我们可以去mysqld.log里面查看一下临时密码:

cat /var/log/mysqld.log

下面我们就可以使用你的临时密码登录数据库


画线的部分就是安装好生成的初始密码


mysql -u root -p+回车
输入临时密码

修改命令:alter USER 'root'@'localhost' IDENTIFIED BY '新密码(必须包含:数字大小写字母特殊字符,长度最小为8位)';

后面一定要加分号,不然无效


然后ctrl+d退出,重新进入就可以了,

输入命令

show databases;

use mysql;

正常就可以了


电脑 电脑