博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
RHEL6.5安装MySQL8.0
阅读量:6766 次
发布时间:2019-06-26

本文共 4993 字,大约阅读时间需要 16 分钟。

之前曾经写过关于RHEL6.5的安装还有网络yum的配置不会的请参考以下两篇文章

系统安装

yum配置

好了既然要装mysql我们就去mysql官网下载最新的安装包吧

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

 

这里就不登录仅下载了

或者你可以将此处的链接复制出来直接在RHEL上面wget一下直接上命令吧

[root@localhost ~]# mkdir /download

[root@localhost ~]# cd /download/
[root@localhost download]# yum -y install wget

略过安装过程。。。

[root@localhost download]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-community-server-8.0.14-1.el6.x86_64.rpm

略过下载过程。。。

解压安装吧

[root@localhost download]# ls

mysql-8.0.14-1.el6.x86_64.rpm-bundle.tar
[root@localhost download]# tar -xf mysql-8.0.14-1.el6.x86_64.rpm-bundle.tar
[root@localhost download]# ll
total 1054088
-rw-r--r--. 1 root root 539688960 Dec 21 22:46 mysql-8.0.14-1.el6.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415 28906092 Dec 21 22:02 mysql-community-client-8.0.14-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 705796 Dec 21 22:02 mysql-community-common-8.0.14-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 4258896 Dec 21 22:02 mysql-community-devel-8.0.14-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 2542980 Dec 21 22:03 mysql-community-libs-8.0.14-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 1769300 Dec 21 22:03 mysql-community-libs-compat-8.0.14-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 414593048 Dec 21 22:03 mysql-community-server-8.0.14-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 86904716 Dec 21 22:04 mysql-community-test-8.0.14-1.el6.x86_64.rpm

接下来就开始安装吧,这里提供一个非常简单的方法一条命令搞定

[root@localhost download]# yum -y install mysql-community-*

你没看错就这一条命令然后就静等yum为你解决一切依赖关系吧

[root@localhost download]# service mysqld status

mysqld is stopped
[root@localhost download]# service mysqld start
Starting mysqld: [ OK ]

不错服务成功启动了说明安装没问题了继续往下吧

 

修改MySQL配置文件:vim /etc/my.cnf,在文件末尾加上:skip-grant-tables,保存后重启MySQL服务:service mysqld restart,然后重新登录

[root@localhost download]# cat /etc/my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]

#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid
skip-grant-tables
[root@localhost download]# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@localhost download]#

 

接下来我们就可以登录了(首次登录没有密码直接回车)

[root@localhost download]# mysql -u root -p

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.14 MySQL Community Server - GPL

Copyright (c) 2000, 2019, 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>

下面就发挥你的想象尽情的玩耍吧!!

mysql> alter user'root'@'%' IDENTIFIED BY '123456';

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

mysql> ALTER user 'root'@'localhost' IDENTIFIED BY '123456';

Query OK, 0 rows affected (0.04 sec)

额这个我也没想到多次尝试才发现,居然只需要刷新一下权限就可以进行修改了。那么既然修改成功了为了安全起见那我们就吧配置文件中的skip-grant-tables删掉并重启服务吧

mysql> flush privileges;

Query OK, 0 rows affected (0.05 sec)

mysql> GRANT ALL ON *.* TO 'root'@'%';

ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.06 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

Query OK, 0 rows affected (0.03 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';

Query OK, 0 rows affected (0.02 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)

到这里授权就算搞定了要想连接还需要配置防火墙我这里就直接关闭防火墙了

[root@localhost ~]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]

下面就是用工具测试一下吧

OK我们可以用连接工具连接了,注意我这里授权的是Navicat连接如需要其他工具连接需要给对应的授权哦

 

转载于:https://www.cnblogs.com/lch1990/p/10313116.html

你可能感兴趣的文章
Hyper-V 2012 R2 无法使用共享VHDX创建群集的可能
查看>>
Xbox One手柄
查看>>
洛谷—— P2504 [HAOI2006]聪明的猴子
查看>>
fatal error LNK1112: 模块计算机类型“X64”与目标计算机类型“x86”冲突_(解决方案)...
查看>>
ext4
查看>>
利用时间戳来准确计算某个时间点具现在的时间差(转)
查看>>
SDUT 小鑫の日常系列故事(六)——奇遇记 递推算法
查看>>
MySQL出现同步延迟有哪些原因?如何解决?
查看>>
Kaviza VDI-in-a-box 实验手册
查看>>
更改Lion中Mission Control背景壁纸的方法
查看>>
Mac安装pycrypto
查看>>
ccf算法模板
查看>>
SGA_TARGET与SGA_MAX_SIZE
查看>>
云计算硬件交换设备参数配置考虑
查看>>
安装django错误
查看>>
Java输入两个正整数m和n,求其最大公约数和最小公倍数。
查看>>
在Solaris 10编译并安装vim7.3
查看>>
Java中抽象类、接口、父类直接的区别与联系
查看>>
Google Chrome OS 将来能取代 Windows 帝国吗?
查看>>
设计原则二:空间和图底关系
查看>>