RHEL6系列下安装Mysql5.6

mysql-5.6.16.tar.gz源码包下载:

http://down.51cto.com/data/1875835

[[email protected] ~]# yum -y install gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel make cmake

tar -xzvf mysql-5.6.16.tar.gz  #解压缩文件

tar -czvf mysql-5.6.16.tar.gz  #压缩文件

[[email protected] ~]#groupadd mysql

[[email protected] ~]#useradd -r -g mysql mysql

[[email protected] ~]# tar -xzvf mysql-5.6.16.tar.gz

[[email protected] ~]# cd mysql-5.6.16

[[email protected] mysql-5.6.16]# cmake .

[[email protected] mysql-5.6.16]# make && make install

[[email protected] mysql-5.6.16]# chown -R mysql.mysql /usr/local/mysql

[[email protected] mysql-5.6.16]# cd /usr/local/mysql/scripts/

[[email protected] scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

[[email protected] scripts]# cd /usr/local/mysql/support-files/

[[email protected] support-files]# cp mysql.server /etc/rc.d/init.d/mysql

[[email protected] support-files]# cp my-default.cnf /etc/my.cnf

[[email protected] support-files]# chkconfig --add mysql

[[email protected] support-files]# chkconfig mysql on

[[email protected] support-files]# service mysql start

Starting MySQL...                                          [  OK  ]

[[email protected] support-files]# ln -s /usr/local/mysql/bin/* /usr/bin/

[[email protected] support-files]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.16 Source distribution

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

mysql> status;

--------------

mysql  Ver 14.14 Distrib 5.6.16, for Linux (x86_64) using  EditLine wrapper

Connection id:1

Current database:

Current user:[email protected]

SSL:Not in use

Current pager:stdout

Using outfile:‘‘

Using delimiter:;

Server version:5.6.16 Source distribution

Protocol version:10

Connection:Localhost via UNIX socket

Server characterset:latin1

Db     characterset:latin1

Client characterset:utf8

Conn.  characterset:utf8

UNIX socket:/tmp/mysql.sock

Uptime:1 min 34 sec

Threads: 1  Questions: 5  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.053

--------------

mysql>

创建Oracle数据库中SCOTT用户的测试表:

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> show database;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘database‘ at line 1

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

mysql> CREATE TABLE dept

-> (

-> deptno INT PRIMARY KEY,

-> dname VARCHAR(14),

-> loc VARCHAR(13)

-> );

Query OK, 0 rows affected (0.04 sec)

mysql> CREATE TABLE emp

-> (

-> EMPNO INT(4) PRIMARY KEY,

-> ENAME VARCHAR(10),

-> JOB VARCHAR(10),

-> MGR INT(4),

-> HIREDATE DATE,

-> SAL DOUBLE,

-> COMM DOUBLE,

-> deptno INT,

-> FOREIGN KEY (deptno) REFERENCES dept(deptno));

Query OK, 0 rows affected (0.02 sec)

mysql> CREATE TABLE salgrade

-> (grade INT PRIMARY KEY,

-> losal INT,

-> hisal INT);

Query OK, 0 rows affected (0.02 sec)

mysql>

插入测试数据:

mysql> INSERT INTO dept VALUES

->  (10,‘ACCOUNTING‘,‘NEW YORK‘);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO dept VALUES

->  (20,‘RESEARCH‘,‘DALLAS‘);

Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO dept VALUES

->  (30,‘SALES‘,‘CHICAGO‘);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO dept VALUES

->  (40,‘OPERATIONS‘,‘BOSTON‘);

Query OK, 1 row affected (0.00 sec)

mysql>

mysql> INSERT INTO emp VALUES

-> (7369,‘SMITH‘,‘CLERK‘,7902,DATE(‘1980-12-17‘),800,NULL,20);

RT INTO emp VALUES

(7566,‘JONES‘,‘MANAGER‘,7839,DATE(‘1981-4-2‘),2975,NULL,20);

INSERT INTO emp VALUES

(7654,‘MARTIN‘,‘SALESMAN‘,7698,DATE(‘1981-9-28‘),1250,1400,30);

INSERT INTO emp VALUES

(7698,‘BLAKE‘,‘MANAGER‘,7839,DATE(‘1981-5-1‘),2850,NULL,30);

INSERQuery OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7499,‘ALLEN‘,‘SALESMAN‘,7698,DATE(‘1981-2-20‘),1600,300,30);

Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO emp VALUES

-> (7521,‘WARD‘,‘SALESMAN‘,7698,DATE(‘1981-2-22‘),1250,500,30);

T INTO emp VALUES

(7844,‘TURNER‘,‘SALESMAN‘,7698,DATE(‘1981-9-8‘),1500,0,30);

INSERT INTO emp VALUES

(7876,‘ADAMS‘,‘CLERK‘,7788,DATE(‘1987-5-23‘),1100,NULL,20);

INSERT INTO emp VALUES

(7900,‘JAMES‘,‘CLERK‘,7698,DATE(‘1981-12-3‘),950,NULL,30);

INSERT INTO eQuery OK, 1 row affected (0.01 sec)

mysql> INSERT INTO emp VALUES

-> (7566,‘JONES‘,‘MANAGER‘,7839,DATE(‘1981-4-2‘),2975,NULL,20);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7654,‘MARTIN‘,‘SALESMAN‘,7698,DATE(‘1981-9-28‘),1250,1400,30);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7698,‘BLAKE‘,‘MANAGER‘,7839,DATE(‘1981-5-1‘),2850,NULL,30);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7782,‘CLARK‘,‘MANAGER‘,7839,DATE(‘1981-6-9‘),2450,NULL,10);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7788,‘SCOTT‘,‘ANALYST‘,7566,DATE(‘1987-4-19‘),3000,NULL,20);

mp VALUES

(7902,‘FORD‘,‘ANALYST‘,7566,DATE(‘1981-12-3‘),3000,NULL,20);

INSERT INTO emp VALUES

(7934,‘MILLER‘,‘CLERK‘,7782,DATE(‘1982-1-23‘),1300,NULL,10);Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7839,‘KING‘,‘PRESIDENT‘,NULL,DATE(‘1981-11-17‘),5000,NULL,10);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7844,‘TURNER‘,‘SALESMAN‘,7698,DATE(‘1981-9-8‘),1500,0,30);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7876,‘ADAMS‘,‘CLERK‘,7788,DATE(‘1987-5-23‘),1100,NULL,20);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7900,‘JAMES‘,‘CLERK‘,7698,DATE(‘1981-12-3‘),950,NULL,30);

Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO emp VALUES

-> (7902,‘FORD‘,‘ANALYST‘,7566,DATE(‘1981-12-3‘),3000,NULL,20);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO emp VALUES

-> (7934,‘MILLER‘,‘CLERK‘,7782,DATE(‘1982-1-23‘),1300,NULL,10);

Query OK, 1 row affected (0.00 sec)

mysql>

mysql> INSERT INTO salgrade VALUES(1,700,1200);

Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO salgrade VALUES(2,1201,1400);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO salgrade VALUES(3,1401,2000);

Query OK, 1 row affected (0.02 sec)

mysql> INSERT INTO salgrade VALUES(4,2001,3000);

Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO salgrade VALUES(5,3001,9999);

Query OK, 1 row affected (0.00 sec)

mysql>

[1]脚本参考:

如何在Mysql数据库中创建Oracle数据库scott的几张表格

时间: 2024-10-25 10:38:59

RHEL6系列下安装Mysql5.6的相关文章

Linux(Red Hat 6 32位) 下安装Mysql5.6.30

1. 下载MySQL 5.6 下载页面:http://dev.mysql.com/downloads/mysql/ 此处选择"Red Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 32-bit), RPM Bundle"下载,下载至/root/fuxian/目录下,下载文件名为"MySQL-5.6.30-1.el6.i686.rpm-bundle.tar" 2. 解压tar包 cd /fuxian/Downloads/

CentOS-7下安装MySQL5.6.22

CentOS7下安装MySQL5.6.22(当前最新版本:2015-01-17) 转载请注明出处:jiq?钦's technical Blog 一  安装环境 (1)CentOS版本:CentOS-7 查看方法: [[email protected] 桌面]# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) 来源:官网下载 下载地址:http://www.centos.org/ (2)MySQL版本:MySQL-5.6.2

CentOS 5.5下安装mysql5.1.57+php5.2.17(FastCGI)+nginx1.0.1高性能Web服务器 [转载]

CentOS 5.5下安装mysql5.1.57+php5.2.17(FastCGI)+nginx1.0.1高性能Web服务器 [转载] 2012年09月05日 ⁄ Linux技术 ⁄ 共 12362字 ⁄ 字号 小 中 大 ⁄ 暂无评论 ⁄ 阅读 85 views 次 由于生产环境都是freebsd平台,之前也写了一篇FreeBSD下安装 mysql5.1.56+php5.2.17(FastCGI)+nginx1.0.1高性能Web服务器,有童鞋想要帮忙写一篇关于centos下的安 装教程,其

Linux下安装mysql5.6.11(找点有用的信息太费劲)(转)

Linux下安装mysql5.6.11(找点有用的信息太费劲) (2013-04-25 10:25:09)     1.申请阿里云Linux服务器 昨天在阿里云申请了一个免费试用5天的Linux云服务器. 操作系统:Red Hat Enterprise Linux Server 5.4 64位. CPU:1核 内存:512M 硬盘空间:20G 带宽:1Mbps. 今天在这台云服务器上安装了基本环境(JDK.Tomcat和MySQL).本文主要在阿里云Linux云服务器安装MySQL全过程,以及对

Windows下安装MySQL-5.7.19

下载MySQL-5.7.19版本,解压之后发现安装包不是一个exe文件: 于是网上找资料,发现了另外一种安装方法. 1.新建一个环境变量,我的电脑-属性-高级-环境变量-系统变量-新建 2.在系统变量的path末尾添加上刚刚新建的系统变量.(把;%MYSQL_HOME%\bin插入到Path的最后面) 3.以管理员的身份运行命令行,按win+R 输入cmd,点鼠标右键以管理员身份运行 4.命令行执行:%MYSQL_HOME%\bin\mysqld --initialize --user=mysq

CentOS7下安装MySQL5.7安装与配置(YUM)

CentOS7下安装MySQL5.7安装与配置(YUM) 安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置YUM源 在MySQL官网中下载YUM源rpm安装包:http://dev.mysql.com/downloads/repo/yum/ # 下载mysql源安装包shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm# 安装mysql源shell> yum l

mac下安装mysql5.7.18,连接出现Access denied for user 'root'@'localhost' (using password: YES)

mac下,mysql5.7.18连接出错,错误信息为:Access denied for user 'root'@'localhost' (using password: YES) ()里面的为shell中输入的命令,一定要输全包括:&等符号 第一步:苹果->系统偏好设置->最下面点MySQL,关闭mysql服务 第二步:进入终端输入(cd /usr/local/mysql/bin/)回车 输入(sudo su)回车以获取管理员权限 输入(./mysqld_safe --skip-gr

centOS6.3下安装mysql5.6详解

首先去mysql官网下载需要的linux版本的mysql,我下的是MySQL-5.6.17-1.linux_glibc2.5.x86_64.rpm-bundle.tar 下载网址为:http://dev.mysql.com/downloads/mysql/ 接下来把下载下来的mysql拖到centOS中去,也可以直接在centOS中下载. 接下来解压下载好的文件 [[email protected] src]# tar -xvf MySQL-5.6.17-1.linux_glibc2.5.x86

使用Spring+MySql实现读写分离(一)关于windows下安装mysql5.6

前面讲过关于mysql的优化,主要是建表时对于大量数据的表添加索引机制,提高查询效率,以及一些sql语句的简单优化,毕竟我也不是专业的数据库管理员,大牛勿喷. 今天写两章关于javaweb项目中,对于数据库的优化,主要目的是减少数据库的访问压力和读写压力. 因为平时工作都是在windows上开发,所以讲解下windows下安装mysql5.6 1. 下载 http://dev.mysql.com/downloads/windows/installer/5.6.html 2. 安装 我们采用自定义