mysql企业版 5.6.18 安装_Mysql 5.6.18解压包版在Rhel6.7上安装

Mysql的安装方式有三种:RPM包、二进程包和源码包。RPM二进制源码

优点安装简单,适合初学者学习使用安装简单;可以安装到任何路径下,灵活性好;一台服务器可以安装多个MySQL在实际安装的操作系统进行可根据需要定制编译,最灵活;性能最好;一台服务器可以安装多个MySQL

缺点需要单独下载客户端和服务器;安装路径不灵活,默认路径不能修改,一台服务器只能安装一个MySQL已经经过编译,性能不如源码编译得好;不能灵活定制编译参数安装过程较复杂;编译时间长

文件布局/usr/bin(客户端程序和脚本)

/usr/sbin(mysqld服务器)/var/lib/mysql(日志文件和数据库)/usr/share/doc/packages(文档)

/usr/include/mysql(包含(头)文件)

/usr/lib/mysql(库文件)/usr/share/mysql(错误消息和字符集文件)/usr/share/sql-bench(基准程序)bin(客户端程序和mysqld服务器)

data(日志文件和数据库)docs(文档和ChangeLog)include(包含(头)文件)lib(库文件)

scripts(mysql_install_db脚本,用来安装系统数据库)

share/mysql(错误消息文件)

sql-bench(基准程序)bin(客户端程序和脚本)include/mysql(包含(头)文件)

info(Info格式的文档)lib/mysql(库文件)

libexec(mysqld服务器)、share/mysql(错误消息文件)

sql-bench(基准程序和crash-me测试)

var(数据库和日志文件)

摘自深入浅出MySQL

1、配置环境和创建用户[root@rhel6 ~]# mkdir /opt/mysql

[root@rhel6 ~]# mkdir /mysqldata

[root@rhel6 ~]# groupadd mysql

[root@rhel6 ~]# useradd -r -g mysql -s /bin/flase mysql

[root@rhel6 ~]# chown mysql:mysql /opt/mysql

[root@rhel6 ~]# chown mysql:mysql /mysqldata

--关闭selinux

[root@rhel6 ~]# vi /etc/selinux/config

SELINUX=disabled

--配置环境变量

[root@rhel6 scripts]# vi ~/.bash_profile

--添加下面两条

export MYSQL_PATH=/opt/mysql/mysql5.6.18

export PATH=$PATH:$MYSQL_PATH/bin

[root@rhel6 scripts]# source ~/.bash_profile

2、上传并解压安装包[root@rhel6 ~]# cd /opt/mysql/

[root@rhel6 mysql]# ls

mysql-advanced-5.6.18-linux-glibc2.5-x86_64.tar.gz

[root@rhel6 mysql]# tar -zxvf mysql-advanced-5.6.18-linux-glibc2.5-x86_64.tar.gz

mysql-advanced-5.6.18-linux-glibc2.5-x86_64/bin/mysql_convert_table_format

mysql-advanced-5.6.18-linux-glibc2.5-x86_64/bin/mysql_client_test

mysql-advanced-5.6.18-linux-glibc2.5-x86_64/bin/mysqlhotcopy

mysql-advanced-5.6.18-linux-glibc2.5-x86_64/bin/mysqladmin

mysql-advanced-5.6.18-linux-glibc2.5-x86_64/bin/msql2mysql

......

[root@rhel6 mysql]# mv mysql-advanced-5.6.18-linux-glibc2.5-x86_64 mysql5.6.18

[root@rhel6 mysql]# ll

total 306412

drwxr-xr-x 13 root root      4096 Nov 13 20:38 mysql5.6.18

-rw-r--r--  1 root root 313754429 Nov 13 20:37 mysql-advanced-5.6.18-linux-glibc2.5-x86_64.tar.gz

[root@rhel6 mysql]# chown -R mysql:mysql mysql5.6.18/

[root@rhel6 mysql]# ll

total 306412

drwxr-xr-x 13 mysql mysql      4096 Nov 13 20:38 mysql5.6.18

-rw-r--r--  1 root  root  313754429 Nov 13 20:37 mysql-advanced-5.6.18-linux-glibc2.5-x86_64.tar.gz

3、安装mysql[root@rhel6 mysql]# cd /opt/mysql/mysql5.6.18/support-files/

[root@rhel6 support-files]# ls

binary-configure  magic  my-default.cnf  mysqld_multi.server  mysql-log-rotate  mysql.server  solaris

[root@rhel6 support-files]# cd /opt/mysql/mysql5.6.18/scripts/

[root@rhel6 scripts]# ls

mysql_install_db

[root@rhel6 scripts]# ./mysql_install_db --user=mysql --basedir=/opt/mysql/mysql5.6.18 --datadir=/mysqldata

WARNING: The host 'rhel6' could not be looked up with /opt/mysql/mysql5.6.18/bin/resolveip.

This probably means that your libc libraries are not 100 % compatible

with this binary MySQL version. The MySQL daemon, mysqld, should work

normally with the exception that host name resolving will not work.

This means that you should use IP addresses instead of hostnames

when specifying MySQL privileges !

Installing MySQL system tables...2016-11-13 20:42:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-11-13 20:42:18 1421 [Note] InnoDB: Using atomics to ref count buffer pool pages

......

OK

Filling help tables...2016-11-13 20:42:21 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

......

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/opt/mysql/mysql5.6.18/bin/mysqladmin -u root password 'new-password'

/opt/mysql/mysql5.6.18/bin/mysqladmin -u root -h rhel6 password 'new-password'

Alternatively you can run:

/opt/mysql/mysql5.6.18/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; /opt/mysql/mysql5.6.18/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /opt/mysql/mysql5.6.18/my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

可以看到安装完成后mysql会给出一些提示、建议。

4、复制相关文件[root@rhel6 scripts]# cp /opt/mysql/mysql5.6.18/support-files/mysql.server /etc/init.d/mysqld

[root@rhel6 scripts]# cp /opt/mysql/mysql5.6.18/support-files/my-default.cnf /etc/my.cnf

cp: overwrite `/etc/my.cnf'? yes

注意不要使用系统自带的/etc/my.cnf文件,否则启动mysql服务时会报错。

Starting MySql.. ERROR! The server quit without updating PID file(/var/mysql/data/rhel6.pid).

5、修改参数[root@rhel6 scripts]# vi /etc/init.d/mysqld

##修改下面两个参数如下

basedir=/opt/mysql/mysql5.6.18

datadir=/mysqldata

6、加入开机启动[root@rhel6 scripts]# chkconfig --levels 235 mysqld on

[root@rhel6 scripts]# chkconfig --list mysqld

mysqld         0:off1:off2:on3:on4:on5:on6:off

7、启动mysql服务[root@rhel6 scripts]# service mysqld start

Starting MySQL. SUCCESS!

8、连接mysql[root@rhel6 scripts]# mysql -uroot

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

Your MySQL connection id is 1

Server version: 5.6.18-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

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

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

| Database           |

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

| information_schema |

| mysql              |

| performance_schema |

| test               |

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

4 rows in set (0.00 sec)

9、mysql的帮助1.用“?contents”命令来显示所有可供查询的的分类

mysql> ? contents

You asked for help about help category: "Contents"

For more information, type 'help ', where  is one of the following

categories:

Account Management

Administration

Compound Statements

Data Definition

Data Manipulation

Data Types

Functions

Functions and Modifiers for Use with GROUP BY

Geographic Features

Help Metadata

Language Structure

Plugins

Procedures

Storage Engines

Table Maintenance

Transactions

User-Defined Functions

Utility

mysql> help data types

You asked for help about help category: "Data Types"

For more information, type 'help ', where  is one of the following

topics:

AUTO_INCREMENT

BIGINT

BINARY

BIT

BLOB

BLOB DATA TYPE

BOOLEAN

CHAR

CHAR BYTE

DATE

DATETIME

DEC

DECIMAL

DOUBLE

DOUBLE PRECISION

ENUM

FLOAT

INT

INTEGER

LONGBLOB

LONGTEXT

MEDIUMBLOB

MEDIUMINT

MEDIUMTEXT

SET DATA TYPE

SMALLINT

TEXT

TIME

TIMESTAMP

TINYBLOB

TINYINT

TINYTEXT

VARBINARY

VARCHAR

YEAR DATA TYPE

mysql> help int

Name: 'INT'

Description:

INT[(M)] [UNSIGNED] [ZEROFILL]

A normal-size integer. The signed range is -2147483648 to 2147483647.

The unsigned range is 0 to 4294967295.

URL: http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值