MySQL在很多领域被广泛使用,尤其是很多互联网企业,诸如腾讯,阿里等等。本文主要介绍在Linux 5下通过rpm方式来安装Mysql,这是比较简单的一种安装方式,具体详见下文。
《MySQL权威指南(原书第2版)》清晰中文扫描版 PDF http://www.linuxidc.com/Linux/2014-03/98821.htm
1、准备对应的安装文件
下载页面:http://dev.mysql.com/downloads/mysql/
找到对应的版本及所需的文件进行下载,如果下载的为tar文件,请使用tar解压
本人在Oracle Edelivery 下载,所以为V44331-01.zip
#安装环境
[root@linux1 Mysql_src]# cat /etc/issue
Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
Kernel \r on an \m
#源文件路径
[root@linux1 Mysql_src]# pwd
/Mysql_src
[root@linux1 Mysql_src]# unzip V44331-01.zip
Archive:  V44331-01.zip
 extracting: MySQL-embedded-advanced-5.6.17-1.rhel5.i386.rpm  
 extracting: MySQL-test-advanced-5.6.17-1.rhel5.i386.rpm  
 extracting: MySQL-shared-advanced-5.6.17-1.rhel5.i386.rpm          # MySQL的共享库
 extracting: MySQL-devel-advanced-5.6.17-1.rhel5.i386.rpm          # MySQL的库和头文件
 extracting: MySQL-client-advanced-5.6.17-1.rhel5.i386.rpm          # MySQL客户端程序
 extracting: MySQL-server-advanced-5.6.17-1.rhel5.i386.rpm          # MySQL服务端程序
 extracting: MySQL-shared-compat-advanced-5.6.17-1.rhel5.i386.rpm  # RHEL兼容包
 extracting: README.txt              
 
2、MySQL默认安装路径
 Directory            Contents of Directory
/usr/bin              Client programs and scripts
/usr/sbin              The mysqld server
/var/lib/mysql        Log files, databases
/usr/share/info        Manual in Info format
/usr/share/man        Unix manual pages
/usr/include/mysql    Include (header) files
/usr/lib/mysql        Libraries
/usr/share/mysql      Miscellaneous support files, including error messages,
                        character set files, sample configuration files, SQL for database installation
/usr/share/sql-bench  Benchmarks
 
3、安装MySQL
[root@linux1 Mysql_src]# rpm -ivh MySQL-server-advanced-5.6.17-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
  1:MySQL-server-advanced  ########################################### [100%]
2014-04-15 17:26:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-04-15 17:26:59 6524 [Note] InnoDB: Using mutexes to ref count buffer pool pages
                  ...........................
2014-04-15 17:27:06 6558 [Note] InnoDB: FTS optimize thread exiting.
2014-04-15 17:27:06 6558 [Note] InnoDB: Starting shutdown...
2014-04-15 17:27:08 6558 [Note] InnoDB: Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
  /usr/bin/mysql_secure_installation
#  Author : Leshami
#  Blog  : http://www.linuxidc.com
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
                  ...........中间省略................
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
[root@linux1 Mysql_src]# rpm -ivh MySQL-client-advanced-5.6.17-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
  1:MySQL-client-advanced  ########################################### [100%]
[root@linux1 Mysql_src]# rpm -ivh MySQL-devel-advanced-5.6.17-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
  1:MySQL-devel-advanced  ########################################### [100%]
更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-04/100535p2.htm

4、初始化MySQL及密码
[root@linux1 Mysql_src]# service mysql start
Starting MySQL.. [ OK ]
[root@linux1 Mysql_src]# more /root/.mysql_secret
# The random password set for the root user at Tue Apr 15 17:27:05 2014 (local time): lyHfNb87EBXhJDe2
[root@linux1 Mysql_src]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.17-enterprise-commercial-advanced
mysql> set PASSWORD=PASSWORD('mysql');
Query OK, 0 rows affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.03 sec)
 
5、允许远程登陆
mysql> use mysql;
Database changed
mysql> select host,user,password from user;
+-------------------+------+-------------------------------------------+
| host | user | password |
+-------------------+------+-------------------------------------------+
| localhost | root | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |
| linux1.orasrv.com | root | *AE207AEF7D22B37183E435AAE64CECF7102A2DB2 |
| 127.0.0.1 | root | *AE207AEF7D22B37183E435AAE64CECF7102A2DB2 |
| ::1 | root | *AE207AEF7D22B37183E435AAE64CECF7102A2DB2 |
+-------------------+------+-------------------------------------------+
4 rows in set (0.02 sec)
mysql> update user set password=password('mysql') where user='root';
mysql> update user set host='%' where user='root' and host='localhost';
mysql> flush privileges;
mysql> exit
6、配置开机自启动
[root@linux1 Mysql_src]# chkconfig --list mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
如果没有的话使用chkconfig mysql on 设置自启动

Linux 5 下安装MySQL 5.6(RPM方式)的更多相关文章

  1. Linux系统下安装配置JDK(rpm方式及tar.gz方式)

    以前都是在Windows环境进行开发的,最近因工作需要:学习在Linux系统下搭建开发环境,自此记录搭建过程,以方便查阅. 本文借鉴了 Angel挤一挤 .小五 两位的博客. 准备材料: JDK下载链 ...

  2. 在linux系统下安装mysql详解,以及远程调用连接不上mysql的解决方法。

    步骤: 1)查看CentOS自带的mysql 输入 rpm -qa | grep mysql 2)将自带的mysql卸载 3)上传Mysql的安装包到linux 4)安装mysql的依赖(不是必须) ...

  3. Linux系统下安装Mysql

    原文档地址:http://www.itpub.net/thread-1766546-1-1.html 1.在Linux服务器上通过wget命令取得rpm包: wget –c http://dev.my ...

  4. MySql入门(2-1)windows下安装mysql的两种方式

    一.下载mysql 1.下载解压MySQL 登录oracle主页,需要用户名和口令: lshengqi@netease.com/1wsx**** 下载路径:: https://dev.mysql.co ...

  5. Linux/CentOS下安装MySql RPM Bundle

    一.下载对应的版本的MySql安装文件 1.下载路径 https://dev.mysql.com/downloads/mysql/ 2.选择对应的Linux版本和x86/x64位的安装文件 查看Lin ...

  6. Linux(Centos)下安装MySQL

    转载:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 一.mysql简介 说到数据库,我们大多想到的是关 ...

  7. 【转】Linux系统上安装MySQL 5.5 rpm

    1.准备工作 从MySQL官网上分别下载mysql服务器端于客户端包. 如: MySQL-server-5.5.15-1.linux2.6.x86_64.rpm和MySQL-client-5.5.15 ...

  8. Linux 环境下安装Mysql的步骤

    一,以linux cent 6.9 安装mysql 5.6.39为例#下载安装包wget --no-check-certificate https://dev.mysql.com/get/Downlo ...

  9. Linux平台下安装MySQL

    1.下载RPM包 http://dev.mysql.com/downloads/mysql/5.5.html#downloads 选择[Red Hat & Oracle Enterprise ...

随机推荐

  1. [Contest20180316]Game

    这题有一个结论:如果他是最强的(⑨),那么线段树最优,如果他是最弱的,那么链状树最优 严格证明可能挺困难,感性理解就是公平赛制让强的人容易赢,极度不公平的赛制能让弱的人有机会反杀 所以我们只改他的能力 ...

  2. 【动态规划】【最短路】【spfa】bzoj1207 [HNOI2004]打鼹鼠

    <法一>若打了一只鼹鼠后,还能打另一只,我们可以在它们之间连权值为1的边.于是答案就是 以m为终点的最长路长度+1.建反图,就是单源最长路. MLE TLE 一时爽. #include&l ...

  3. 6.1(java学习笔记)File类

    1.路径分隔符,文件分隔符. 路径分隔符(“:”) 文件名称分隔符(“\”windows,“/”Linux等). 不同平台使用的文件分隔符是不一样的,所以File类中提供了分隔符常量,它会根据平台的不 ...

  4. ujmp使用心得

    1)对矩阵转置运算时: Matrix test2 = oneMatrix.transpose(); Matrix test2 = oneMatrix.transpose(Ret.LINK); Matr ...

  5. Scala实战高手****第10课:Scala继承彻底实战和Spark源码鉴赏

    isInstanceOf  和 asInstanceOf is用于判断 as用于转换,把父类类型转换成子类类型   getClass 具体找出类型    

  6. 使用urlretrieve下载图片

    示例代码: from urllib.request import urlretrieve from urllib.request import urlopen from bs4 import Beau ...

  7. Git -- git中本地与远程库的关联与取消

    1.在本地目录下关联远程repository : git remote add origin git@github.com:git_username/repository_name.git 2.取消本 ...

  8. shell脚本之检查局域网中在线的ip地址

    [root@docker-node1 ]# cat ping.sh #!/bin/bash . /etc/init.d/functions for var in {1..254}; do ip=192 ...

  9. HTC VIVE SDK 中的例子 hellovr_opengl 程序流程分析

    最近Vive的VR头盔设备很火,恰逢项目需求,所以对 SDK 中的例子 hellovr_opengl 做了比较细致的代码分析,先将流程图绘制如下,便于大家理解. 在ViVe头盔中实现立体效果的技术核心 ...

  10. python 下载小说

    以下载官场风月小说为例: 具体代码: # coding=utf-8 import os import re from selenium import webdriver from selenium.c ...