RHEL6.5安装MySQL

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

系统安装https://www.cnblogs.com/lch1990/p/10310304.html

yum配置https://www.cnblogs.com/lch1990/p/10299714.html

好了既然要装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>

下面就发挥你的想象进行的玩耍吧!!

猜你喜欢

转载自www.cnblogs.com/lch1990/p/10313116.html