【MySQL】linux平台下安装配置MySQL- rpm包的方式

一. 前言

mysql的安装相对来说比较简单,在centos6的系统里使用yum安装是最省事的做法,不过为了让大家熟悉mysql官网,在这里我们演示rpm包的安装方式
本机使用的操作系统为: centos6.9

二. rpm 包下载

数据包下载: https://www.mysql.com/downloads/

linuxnux平台上推荐使用RPM包来安装Mysql,MySQL 提供了以下RPM包的下载地址:

  • MySQL-MySQL服务器。你需要该选项,除非你只想连接运行在另一台机器上的MySQL服务器。
  • MySQL-client - MySQL 客户端程序,用于连接并操作Mysql服务器。
  • MySQL-devel - 库和包含文件,如果你想要编译其它MySQL客户端,例如Perl模块,则需要安装该RPM包。
  • MySQL-shared - 该软件包包含某些语言和应用程序需要动态装载的共享库(libmysqlclient.so*),使用MySQL。
  • MySQL-bench - MySQL数据库服务器的基准和性能测试工具。

下载截图:

在这里插入图片描述在这里插入图片描述

1) 选择 mysql community server

在这里插入图片描述

2) 我们选择其他GA版本

在这里插入图片描述

3) 选择5.6的版本下载

在这里插入图片描述

在这里插入图片描述

三. 上传到服务器

在这里插入图片描述

四. 安装mysql

[root@gaosh-1 ~]# yum remove mysql -y
[root@gaosh-1 ~]# rpm -ivh MySQL-server-5.6.49-1.el6.x86_64.rpm 

在这里插入图片描述

五. 启动mysql并检查是否启动

[root@gaosh-1 ~]# /etc/init.d/mysql start
Starting MySQL.Logging to '/var/lib/mysql/gaosh-1.err'.
.. SUCCESS! 
[root@gaosh-1 ~]# ss -lntp |grep mysql
LISTEN     0      80                       :::3306                    :::*      users:(("mysqld",45526,10))
[root@gaosh-1 ~]# 

六. 查看登陆密码并登陆

[root@gaosh-1 ~]# cat /root/.mysql_secret |awk -F: ‘{print $4}’
ShF5U8sDZM68hteE

安装客户端
[root@gaosh-1 ~]# yum localinstall MySQL-client-5.6.49-1.el6.i686.rpm

登陆测试:

[root@gaosh-1 ~]# mysql -uroot -pShF5U8sDZM68hteE
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.49

Copyright (c) 2000, 2020, 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@gaosh-1 mysql]# find / -name mysql
/etc/logrotate.d/mysql
/etc/rc.d/init.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/var/lock/subsys/mysql
/usr/share/mysql
/usr/lib64/mysql
/usr/bin/mysql

总结:

centos6 下安装mysql,使用rpm包的方式是一种简便快捷的方式,需要下去好好练习。

猜你喜欢

转载自blog.csdn.net/xinshuzhan/article/details/108411733
今日推荐