当前位置: 代码迷 >> 综合 >> Redhat-6.6 离线安装mysql
  详细解决方案

Redhat-6.6 离线安装mysql

热度:50   发布时间:2023-12-04 15:53:20.0

1.将 ISO 镜像文件上传至Linux

[root@slave5 soft]# ll rhel-server-6.6-x86_64-dvd.iso 
-rw-r--r--. 1 root root 3782213632 11月 19 19:29 rhel-server-6.6-x86_64-dvd.iso

2. 挂载 ISO

执行命令:

mount -t iso9660 -o loop rhel-server-6.6-x86_64-dvd.iso /mnt/

查看:
在这里插入图片描述

3. 安装

进入 /mnt/Packages 目录:

分别执行安装命令:

rpm -ivh mysql-5.1.73-3.el6_5.x86_64.rpmrpm -ivh perl-DBD-MySQL-4.013-3.el6.x86_64.rpmrpm -ivh mysql-server-5.1.73-3.el6_5.x86_64.rpm

完整过程:

[root@slave5 ~]# mount -t iso9660 -o loop soft/rhel-server-6.6-x86_64-dvd.iso /mnt/
[root@slave5 ~]# cd /mnt/
[root@slave5 mnt]# cd Packages/
[root@slave5 Packages]# rpm -ivh mysql-5.1.73-3.el6_5.x86_64.rpm 
warning: mysql-5.1.73-3.el6_5.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]1:mysql                  ########################################### [100%]
[root@slave5 Packages]# rpm -ivh perl-DBD-MySQL-4.013-3.el6.x86_64.rpm 
warning: perl-DBD-MySQL-4.013-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]1:perl-DBD-MySQL         ########################################### [100%]
[root@slave5 Packages]# rpm -ivh mysql-server-5.1.73-3.el6_5.x86_64.rpm 
warning: mysql-server-5.1.73-3.el6_5.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]1:mysql-server           ########################################### [100%]

4. 配置

启动 mysqld 服务,第一次启动会初始化:

service mysqld start

登录 mysql,没有密码直接回车:

mysql -uroot -p
[root@slave5 ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

为 root 用户设置密码,这里设置为123456,并刷新:

UPDATE mysql.user SET password=password("123456") WHERE USER="root";flush privileges;

退出 mysql ,并且重启 mysqld 服务:

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> quit
Bye
[root@slave5 ~]# service mysqld restart
停止 mysqld:                                              [确定]
正在启动 mysqld:                                          [确定]
[root@slave5 ~]#

再次登录 mysql,这时需要输入登录密码。


PS:创建数据库,添加新用户,赋予该用户hiveDB数据库的所有权限:

mysql> create database hiveDB;
Query OK, 1 row affected (0.00 sec)mysql> create user 'bee' identified by '123456';
Query OK, 0 rows affected (0.00 sec)mysql> grant all privileges on hiveDB.* to 'bee'@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

完!

  相关解决方案