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的几张表格