centos 6.5下 mysql-community-server. 5.7.18-1.el6安装

使用下面的命令检查是否安装有MySQL Server

[root@localhost etc]# rpm -qa | grep mysql // 这个命令就会查看该操作系统上是否已经安装了mysql数据库

有的话,我们就通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉

[root@localhost ~]# rpm -e mysql  // 普通删除模式
[root@localhost ~]# rpm -e --nodeps mysql  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除

在删除完以后我们可以通过 rpm -qa | grep mysql 命令来查看mysql是否已经卸载成功!!

官网yum repository 下载安装包

[root@localhost ~]# wget http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm
 --2017-04-24 18:53:49-- http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm
Resolving dev.mysql.com... 137.254.60.11
Connecting to dev.mysql.com|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm [following]
--2017-04-24 18:53:49-- https://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm
Connecting to dev.mysql.com|137.254.60.11|:443... connected.
ERROR: certificate common name “www.mysql.com” doesn't match requested host name “dev.mysql.com”.
To connect to dev.mysql.com insecurely, use ‘--no-check-certificate'

本地安装下载下来的rpm包

[root@localhost ~]# yum localinstall mysql57-community-release-el6-10.noarch.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Local Package Process
Examining mysql57-community-release-el6-10.noarch.rpm: mysql57-community-release-el6-10.noarch
Marking mysql57-community-release-el6-10.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el6-10 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
 Package                      Arch              Version              Repository                             Size
===============================================================================================================================================================================================
Installing:
 mysql57-community-release             noarch             el6-10               /mysql57-community-release-el6-10.noarch              30 k
Transaction Summary
===============================================================================================================================================================================================
Install    1 Package(s)
Total size: 30 k
Installed size: 30 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : mysql57-community-release-el6-10.noarch                                   1/1
 Verifying : mysql57-community-release-el6-10.noarch                                     1/1
Installed:
 mysql57-community-release.noarch 0:el6-10
Complete!

  查看可用的安装包 

[root@localhost ~]# yum repolist enabled|grep mysql
mysql-connectors-community      MySQL Connectors Community       33
mysql-tools-community        MySQL Tools Community          47
mysql57-community          MySQL 5.7 Community Server       183

安装前装gcc所有包,防止报错[Errno -1]  Package does not match intended download

[root@localhost yum.repos.d]# yum install gcc* 

安装mysql

[root@localhost yum.repos.d]# yum install -y mysql-community-server 
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.18-1.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.18-1.el6 for package: mysql-community-server-5.7.18-1.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.18-1.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.18-1.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.18-1.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.7.18-1.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.18-1.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.18-1.el6 will be obsoleting
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated
---> Package postfix.x86_64 2:2.6.6-8.el6 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================
 Package                 Arch        Version           Repository           Size
=============================================================================================================================
Installing:
 mysql-community-libs          x86_64       5.7.18-1.el6         mysql57-community       2.1 M
   replacing mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-libs-compat       x86_64       5.7.18-1.el6         mysql57-community       1.6 M
   replacing mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-server         x86_64       5.7.18-1.el6         mysql57-community       152 M
Installing for dependencies:
 mysql-community-client         x86_64       5.7.18-1.el6         mysql57-community       23 M
 mysql-community-common         x86_64       5.7.18-1.el6         mysql57-community       328 k
Updating for dependencies:
 postfix                 x86_64       2:2.6.6-8.el6        base             2.0 M
Transaction Summary
=============================================================================================================================
Install    5 Package(s)
Upgrade    1 Package(s)
Total size: 180 M
Total download size: 152 M
Downloading Packages:
mysql-community-server-5.7.18-1.el6.x86_64.rpm                            | 152 MB   01:41
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
 Package: mysql57-community-release-el6-10.noarch (@/mysql57-community-release-el6-10.noarch)
 From  : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : mysql-community-common-5.7.18-1.el6.x86_64                                1/8
 Installing : mysql-community-libs-5.7.18-1.el6.x86_64                                 2/8
 Installing : mysql-community-libs-compat-5.7.18-1.el6.x86_64                              3/8
 Installing : mysql-community-client-5.7.18-1.el6.x86_64                                4/8
 Installing : mysql-community-server-5.7.18-1.el6.x86_64                                5/8
 Updating  : 2:postfix-2.6.6-8.el6.x86_64                                       6/8
 Cleanup  : 2:postfix-2.6.6-2.2.el6_1.x86_64                                     7/8
 Erasing  : mysql-libs-5.1.71-1.el6.x86_64                                      8/8
 Verifying : 2:postfix-2.6.6-8.el6.x86_64                                       1/8
 Verifying : mysql-community-libs-compat-5.7.18-1.el6.x86_64                              2/8
 Verifying : mysql-community-server-5.7.18-1.el6.x86_64                                3/8
 Verifying : mysql-community-libs-5.7.18-1.el6.x86_64                                 4/8
 Verifying : mysql-community-common-5.7.18-1.el6.x86_64                                5/8
 Verifying : mysql-community-client-5.7.18-1.el6.x86_64                                6/8
 Verifying : 2:postfix-2.6.6-2.2.el6_1.x86_64                                     7/8
 Verifying : mysql-libs-5.1.71-1.el6.x86_64                                      8/8
Installed:
 mysql-community-libs.x86_64 0:5.7.18-1.el6         mysql-community-libs-compat.x86_64 0:5.7.18-1.el6
 mysql-community-server.x86_64 0:5.7.18-1.el6
Dependency Installed:
 mysql-community-client.x86_64 0:5.7.18-1.el6         mysql-community-common.x86_64 0:5.7.18-1.el6
Dependency Updated:
 postfix.x86_64 2:2.6.6-8.el6
Replaced:
 mysql-libs.x86_64 0:5.1.71-1.el6
Complete!

启动mysql

[root@localhost yum.repos.d]# service mysqld start  
Initializing MySQL database:                [ OK ]
Installing validate password plugin:            [ OK ]
Starting mysqld: 

  进入mysql安全模式

[root@localhost yum.repos.d]# killall -TERM mysqld
[root@localhost yum.repos.d]# mysqld_safe --skip-grant-tables &
[1] 40422
[root@localhost yum.repos.d]# 2017-04-25T07:45:39.222061Z mysqld_safe Logging to '/var/log/mysqld.log'.
2017-04-25T07:45:39.246117Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from users;
ERROR 1146 (42S02): Table 'mysql.users' doesn't exist
mysql> select * from user;
mysql> update user set authentication_string=PASSWORD('mysql') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> quit
Bye
[2]+ Exit 1         mysqld_safe --skip-grant-tables
  
[root@localhost yum.repos.d]# service mysqld start
Starting mysqld:                      [ OK ]
[root@localhost yum.repos.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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 -h主机地址 -u用户名 -p用户密码

1、例1:连接到本机上的MYSQL

找到mysql的安装目录,一般可以直接键入命令mysql -uroot -p,回车后提示你输密码,如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中

了,MYSQL的提示符是:mysql>

2、连接到远程主机上的MYSQL

假设远程主机的IP为:10.0.0.1,用户名为root,密码为123。则键入以下命令:

mysql -h10.0.0.1 -uroot -p123

(注:u与root可以不用加空格,其它也一样)

配置防火墙

防火墙的3306端口默认没有开启,若要远程访问,需要开启这个端口

打开/etc/sysconfig/iptables

在“-A INPUT –m state --state NEW –m tcp –p tcp –dport 22 –j ACCEPT”,下添加:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

然后保存,并关闭该文件,在终端内运行下面的命令,刷新防火墙配置:

service iptables restart OK,一切配置完毕,你可以访问你的MySQL了~

注意:增加的开放3306端口的语句一定要在icmp-host-prohibited之前

mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

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

以上所述是小编给大家介绍的centos 6.5下 mysql-community-server. 5.7.18-1.el6安装,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!

(0)

相关推荐

  • C#中Socket与Unity相结合示例代码

    前言 初步接触了Socket,现使其与Unity相结合,做成一个简单的客户端之间可以互相发送消息的一个Test.下面话不多说了,来一起看看详细的介绍吧. 方法如下: 首先,是服务端的代码. 创建一个连接池,用于存储客户端的数量. using System; using System.Net; using System.Net.Sockets; using System.Collections; using System.Collections.Generic; namespace Server

  • Unity3d获取系统时间

    Unity是由Unity Technologies开发的一个让玩家轻松创建诸如三维视频游戏.建筑可视化.实时三维动画等类型互动内容的多平台的综合型游戏开发工具,是一个全面整合的专业游戏引擎.Unity类似于Director,Blender game engine, Virtools 或 Torque Game Builder等利用交互的图型化开发环境为首要方式的软件其编辑器运行在Windows 和Mac OS X下,可发布游戏至Windows.Mac.Wii.iPhone.Windows pho

  • unity实现摄像头跟随

    代码很简单,这里就不多废话了,直接奉上代码 using UnityEngine; using System.Collections; public class FllowTarget : MonoBehaviour { public Transform character; //摄像机要跟随的人物 public float smoothTime = 0.01f; //摄像机平滑移动的时间 private Vector3 cameraVelocity = Vector3.zero; private

  • Unity3d发布IOS9应用时出现中文乱码的解决方法

    简单的说,解决方法就是批量修改NGUI的label字体,修复ios就删除arial引起的中文乱码 我们来看具体如何操作 static public void yaheifont() { uf = AssetDatabase.LoadAssetAtPath("Assets/yahei.prefab",typeof( UIFont)) as UIFont; UnityEngine.Object[] objs = Selection.GetFiltered (typeof(UnityEngi

  • Unity3D获取当前键盘按键及Unity3D鼠标、键盘的基本操作

    获取当前键盘按键,代码如下: using UnityEngine; using System.Collections; public class GetCurrentKey : MonoBehaviour { KeyCode currentKey; void Start () { currentKey = KeyCode.Space; } void OnGUI() { if (Input.anyKeyDown) { Event e = Event.current; if (e.isKey) {

  • Unity3D中shader 轮廓描边效果实现代码

    Unity3D中shader 轮廓描边效果 想利用Unity3D中shader这个功能实现描边轮廓边框效果该怎么做呢,相信有很多搞开发的人想知道,为此下面就给大家介绍下方法. Shade实现描边效果,如下图中的3D球效果图         Shade代码如下: Shader "Outlined/Silhouetted Diffuse" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _OutlineCo

  • Unity编辑器下重启的方法

    Unity编辑器下重启的方法 我们项目AssetBundle打包走的是全自动化流程,打包之前要进行各种资源检测,如果检测顺利通过,则进入打包,否则提示错误资源名称及路径,打包中断!有时候即使资源检测通过也会打包崩溃,初步断定是Unity的内存爆了,因为Unity在编辑器下打开工程中的资源不会释放掉,所以内存一直在占用,打包时要进行一系列资源依赖分析,我们也知道,如果资源量非常大时候,Unity要保存资源依赖的堆栈,所以会有内存崩掉的风险,所以我就想着,打包之前重启下Unity,让Unity释放掉

  • Unity UGUI教程之实现滑页效果

    简介 项目需要...直接展示效果吧: 原理 使用UGUI提供的ScrollRect和ScrollBar组件实现基本滑动以及自己控制每次移动一页来达到滑页的效果. 实现过程 1.创建两个panel,上面的panel用于显示,下面的panel用于存放按钮 2.在TopPanel上添加ScrollRect脚本,用于滑动 3.在TopPanel下创建一个新的Panel,并在子Panel下拜访要显示的对象 4.将该子Panel设置为ScrollRect的活动对象 5.为ScrollRect添加Scroll

  • CentOS服务器环境下MySQL主从同步配置方法

    本文实例讲述了CentOS服务器环境下MySQL主从同步配置方法.分享给大家供大家参考,具体如下: 一.环境 主机: master操作系统:centos 5.3 IP:192.168.1.222 MySQL版本:5.0.77 从机: slave操作系统:centos 5.3 IP:192.168.1.220 MySQL版本:5.0.77 二.创建数据库 分别登录master机和slave机的 mysql:mysql –u root –p 创建数据库: create database repl;

  • Winserver2012下mysql 5.7解压版(zip)配置安装教程详解

    一.安装 1.下载mysql zip版本mysql不需要运行可执行文件,解压即可,下载zip版本mysql msi版本mysql双击文件即可安装,相对简单,本文不介绍此版本安装 2.配置环境变量 打开环境变量配置页面(winserver服务器环境变量位置:服务器管理器->本地服务器->计算机名称->高级->环境变量),在系统变量path后面添加mysql bin文件路径,例如:;C:\mysql-5.7.17-winx64\bin 3.配置mysql mysql配置文件my-def

  • CentOS 7.2下MySQL的安装与相关配置

    一.相关配置如下 操作系统: CentOS 7.2 MySQL版本: 5.7.x 二.下载安装 2.1 下载rpm包 选择相应的版本:系统版本和包版本. 系统版本可以通过 uname -a 来查看: wget http://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm 2.2 下载安装软件源 sudo yum localinstall platform-and-version-specific-package-name.rp

  • 分享CentOS下MySQL最新版本5.6.13源码安装过程

    2个月前公司给DBA的测试服务器被收回去了,一直跟开发用一组DB,有些需要测试的小功能,需要不断重启db,为了不影响开发同事,自己又申请了一个虚拟机,准备安装最新的5.6.13版本的MySQL社区版. 1 download the tar.gzwget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.13.tar.gz/from/http://cdn.mysql.com/ 2 安装cmake软件包yum install cmake 3

  • Windows 8下MySQL Community Server 5.6安装配置方法图文教程

    本文记录了Windows 8下MySQL5.6安装配置教程,分享给大家. 1.1 下载与路径配置 首先先进入官网下载MySQL安装包 选择DOWNLOADS,Community版 下载完后解压 用bin目录的地址添加到环境变量里的路径(Path)里 1.3. 生成data文件: 以管理员身份运行cmd 进入C:\Users\lym96\Desktop\mysql-5.6.40-winx64\bin 下 执行命令:mysqld --initialize-insecure --user=mysql 

  • Windows下mysql community server 8.0.16安装配置方法图文教程

    最近看到很多关于MySql相关的语法,小白也想学习一些MySQL的存储过程的写法,因此就想安装MySQL,过程中遇到过一些问题,这里记录下来~ 第一步:下载 首先,去官网下载匹配电脑的MySQL版本,网址如下:https://www.mysql.com/ 然后,进入到下载的页面: 1)进入下载页 2)找到红框中位置 3)点击下载 4)进入到下载页,在页面中找到匹配的版本,点击下载 5)下载后解压:D:\Users\chen_lib\mysql-8.0.16-winx64(这里小白解压到该地址下)

  • CentOS 7下MySQL服务启动失败的快速解决方法

    今天,启动MySQL服务器失败,如下所示: [root@spark01 ~]# /etc/init.d/mysqld start Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe&qu

  • CentOS 7.0下使用yum安装mysql的方法详解

    CentOS7默认数据库是mariadb,配置等用着不习惯,因此决定改成mysql,但是CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1.下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2.安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mys

  • 阿里云Linux CentOS 7.2下自建MySQL的root密码忘记的解决方法

    验证环境: [root@~~/]# rpm -qa | grep mysql mysql-5.6.28-1.el6.x86_64 [root@~~/]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.2.1511 (Core) Release: 7.2.1511 Codename: Core [root@~

  • CentOS 6.3下源码安装LAMP(Linux+Apache+Mysql+Php)运行环境步骤

    一.简介 什么是LAMP LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而言都是在它所代表的方面功能非常强大的组件. LAMP这个词的由来最早始于德国杂志"c't Magazine",Michael Kunze在1990年最先把这些项目组合在一起创造了LAMP的缩写字.这些组件并不是开始就设计为一起使用的,但是,这些软件都是开源的,可以很方便的随时获得并免费使用,这就导致了这些组件

随机推荐