CentOS 6.9下MySQL5.7.19安装步骤

目录

[TOC]

1、查看当前安装的Linux版本

[[email protected] ~]$ sudo lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.9 (Final)
Release:        6.9
Codename:       Final

2、下载MySQL 安装文件

官方网站 http://www.mysql.com

直接下载 https://downloads.mysql.com/archives/get/file/mysql-5.7.19-1.el6.x86_64.rpm-bundle.tar

3、清理老版本MySQL

3.1、查看操作系统中是否已安装MySQL

[[email protected] ~]$ sudo rpm -qa | grep mysql
mysql-5.1.73-8.el6_8.x86_64
mysql-server-5.1.73-8.el6_8.x86_64
mysql-libs-5.1.73-8.el6_8.x86_64

3.2、删除老版本MySQL数据库安装包

[[email protected] ~]$ sudo rpm -e --nodeps mysql-5.1.73-8.el6_8.x86_64
[[email protected] ~]$ sudo rpm -e --nodeps mysql-server-5.1.73-8.el6_8.x86_64
[[email protected] ~]$ sudo rpm -e --nodeps mysql-libs-5.1.73-8.el6_8.x86_64

3.3、查找老版本MySQL安装遗留的目录和文件

[[email protected] ~]$ find / -name mysql
/var/lib/mysql

3.4、删除老版本MySQL安装遗留的目录和文件

[[email protected] ~]$ sudo rm -rf /var/lib/mysql

4、安装新版本MySQL

4.1、解包

[[email protected] softs]$ tar -xvf mysql-5.7.19-1.el6.x86_64.rpm-bundle.tar
mysql-community-libs-5.7.19-1.el6.x86_64.rpm
mysql-community-devel-5.7.19-1.el6.x86_64.rpm
mysql-community-embedded-5.7.19-1.el6.x86_64.rpm
mysql-community-common-5.7.19-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.19-1.el6.x86_64.rpm
mysql-community-server-5.7.19-1.el6.x86_64.rpm
mysql-community-test-5.7.19-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.19-1.el6.x86_64.rpm
mysql-community-client-5.7.19-1.el6.x86_64.rpm

4.2、安装MySQL

[[email protected] softs]$ sudo rpm -ivh mysql-community-common-5.7.19-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]
[[email protected] softs]$ sudo rpm -ivh mysql-community-libs-5.7.19-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
[[email protected] softs]$ sudo rpm -ivh mysql-community-client-5.7.19-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
[[email protected] softs]$ sudo rpm -ivh mysql-community-server-5.7.19-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]

4.3、启动MySQL数据库

[[email protected] ~]$ sudo service mysqld start
Initializing MySQL database:                               [  OK  ]
Starting mysqld:                                           [  OK  ]
[[email protected] ~]$ sudo mysqld_safe --user=mysql --skip-grant-tables  --skip-networking &
[1] 3598
[[email protected] ~]$ 2017-11-15T01:58:49.095993Z mysqld_safe Logging to ‘/var/log/mysqld.log‘.
2017-11-15T01:58:49.129531Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[[email protected] ~]$ mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19 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> update user set authentication_string = password(‘root123‘) where user = ‘root‘;
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye
[[email protected] ~]$ sudo service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[[email protected] ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.19

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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password for [email protected] = password(‘)OKM9ijn‘);
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql>  flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye

4、远程登录

4.1、授权

[[email protected] ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 5.7.19 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 host, user from user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
3 rows in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘)OKM9ijn‘ WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> select host, user from user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| %         | root          |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
4 rows in set (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.07 sec)

4.2、测试

在其他机器上测试

C:\>mysql -h 192.168.1.144 -u root -p
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.7.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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.
时间: 2024-10-08 20:59:46

CentOS 6.9下MySQL5.7.19安装步骤的相关文章

CentOs6.5系统下MySQL-5.7.19安装

好长时间没有更新了,今天给大家分享一波简单的文档,菜鸟的入门精神就是不断的学习,不断地找大神帮助!!!! 在这里今天给大家推荐一个博文地址:http://sumongodb.blog.51cto.com/ 好了!废话少说,干活走起来!!!!!!!! CentOs6.5下mysql5.7.19二进制安装是我自己编译的官方源码包 首先我们把一些依赖包安装上: yum -y groupinstall "Development tools" yum -y install ncurses ncu

Windows下MySQL5.6.21安装步骤

01.把 mysql-advanced-5.6.17-winx64.zip 解压到自定义 D:\mysql-5.6.17-W64 或 D:\mysql-advanced-5.6.17-winx64 目录下02.我的电脑--属性--高级--环境变量--系统变量--新建系统环境变量 变量名:MYSQL_HOME 变量值:D:\mysql-5.6.17-W6403.向原系统环境变量 Path 中添加 ;%MYSQL_HOME%\bin04.cmd--进到D:\mysql-5.6.17-W64\bin目

CentOS 6.4下Squid代理服务器的安装与配置

一.简介 代理服务器英文全称是Proxy Server,其功能就是代理网络用户去取得网络信息. Squid是一个缓存Internet 数据的软件,其接收用户的下载申请,并自动处理所下载的数据.当一个用户想要下载一个主页时,可以向Squid 发出一个申请,要Squid 代替其进行下载,然后Squid 连接所申请网站并请求该主页,接着把该主页传给用户同时保留一个备份,当别的用户申请同样的页面时,Squid 把保存的备份立即传给用户,使用户觉得速度相当快.Squid 可以代理HTTP.FTP.GOPH

mysql5.6.19安装说明

转载:http://blog.sina.com.cn/s/blog_5391f1100101ojzz.html 1配置mysql的MYSQL_HOME和PATH 2在HOME下面配置my.ini文件,内容如下 [mysqld] loose-default-character-set = utf8 basedir = E:/mysql-5.6.11-winx64 datadir = E:/mysql-5.6.11-winx64/data port = 3306 sql_mode=NO_ENGINE

CentOS 6.6 下源码编译安装MySQL 5.7.5

版权声明:转自:http://www.linuxidc.com/Linux/2015-08/121667.htm 说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# yum -y install gcc-c++ ncurses-devel cmake make perl \ gcc autoconf automake zlib libxml libgcrypt libtool bison2. 清理环境检查boost版本: # rpm -qa boost*卸载b

CentOS 6.5下PXE+Kickstart无人值守安装操作系统

CentOS 6.5下PXE+Kickstart无人值守安装操作系统 一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicasttrivia

LINUX Mysql5.6.19 安装

1.需要扩展安装 yum -y install make bison gcc-c++ cmake ncurses ncurses-devel 2.下载Mysql5.6.19 wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz 3.解压安装 tar zxvf mysql-5.6.19.tar.gz cd mysql-5.6.19 cmake -DCMAKE_INSTALL_PREFIX=/

CentOS 6.3下rsync服务器的安装与配置[转]

CentOS 6.3下rsync服务器的安装与配置 一.rsync 简介 Rsync(remote synchronize)是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件,也可以使用 Rsync 同步本地硬盘中的不同目录. Rsync 是用于取代rcp的一个工具,Rsync使用所谓的 “Rsync 算法” 来使本地和远程两个主机之间的文件达到同步,这个算法只传送两个文件的不同部分,而不是每次都整份传送,因此速度相当快.您可以参考 How Rsync Works A Prac

CentOS 6.9下PXE+Kickstart无人值守安装操作系统附常见问题

CentOS 6.9下PXE+Kickstart无人值守安装操作系统 一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivi