mysql安装二 linux/unix上通用二进制包安装


梳理了一下centos上安装mysql的三种方法:一是通过源码安装,二是用通用二进制包,三是通过不同linux release到系统包安装,centos上是RPM包安装。
 linux/unix上通用二进制包安装

0
[root@host2 ~]# uname -a
Linux host2 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@host2 ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

1
下载地址:
http://dev.mysql.com/downloads/
下载到文件名:
mysql-5.6.22-linux-glibc2.5-x86_64.tar.gz

2
查看已装包
[root@host2 ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@host2 ~]#
[root@host2 ~]#

3
yum删除myslq
[root@host2 ~]# rpm -ef mysql-libs-5.1.71-1.el6.x86_64
error: Failed dependencies:
    libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
    libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
    mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
[root@host2 ~]#
[root@host2 ~]#


[root@host2 ~]# yum -y remove mysql-libs-5.1.71-1.el6.x86_64
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be erased
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be erased
--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-12.el6.x86_64
--> Running transaction check
---> Package cronie.x86_64 0:1.4.4-12.el6 will be erased
--> Processing Dependency: cronie = 1.4.4-12.el6 for package: cronie-anacron-1.4.4-12.el6.x86_64
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6.centos will be erased
--> Processing Dependency: redhat-lsb-core(x86-64) = 4.0 for package: redhat-lsb-printing-4.0-7.el6.centos.x86_64
--> Processing Dependency: redhat-lsb-core(x86-64) = 4.0-7.el6.centos for package: redhat-lsb-4.0-7.el6.centos.x86_64
--> Processing Dependency: redhat-lsb-core(x86-64) = 4.0 for package: redhat-lsb-graphics-4.0-7.el6.centos.x86_64
--> Running transaction check
---> Package cronie-anacron.x86_64 0:1.4.4-12.el6 will be erased
---> Package redhat-lsb.x86_64 0:4.0-7.el6.centos will be erased
--> Processing Dependency: redhat-lsb(x86-64) = 4.0-7.el6.centos for package: redhat-lsb-compat-4.0-7.el6.centos.x86_64
---> Package redhat-lsb-graphics.x86_64 0:4.0-7.el6.centos will be erased
---> Package redhat-lsb-printing.x86_64 0:4.0-7.el6.centos will be erased
--> Running transaction check
---> Package redhat-lsb-compat.x86_64 0:4.0-7.el6.centos will be erased
--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-22.el6.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be erased
---> Package sysstat.x86_64 0:9.0.4-22.el6 will be erased
--> Finished Dependency Resolution
base                                                                                                           | 3.7 kB     00:00     
extras                                                                                                         | 3.4 kB     00:00     
updates                                                                                                        | 3.4 kB     00:00     

Dependencies Resolved

======================================================================================================================================
 Package                       Arch             Version                      Repository                                          Size
======================================================================================================================================
Removing:
 mysql-libs                    x86_64           5.1.71-1.el6                 @anaconda-CentOS-201311272149.x86_64/6.5           4.0 M
Removing for dependencies:
 cronie                        x86_64           1.4.4-12.el6                 @anaconda-CentOS-201311272149.x86_64/6.5           174 k
 cronie-anacron                x86_64           1.4.4-12.el6                 @anaconda-CentOS-201311272149.x86_64/6.5            43 k
 crontabs                      noarch           1.10-33.el6                  @anaconda-CentOS-201311272149.x86_64/6.5           2.4 k
 postfix                       x86_64           2:2.6.6-2.2.el6_1            @anaconda-CentOS-201311272149.x86_64/6.5           9.7 M
 redhat-lsb                    x86_64           4.0-7.el6.centos             @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 redhat-lsb-compat             x86_64           4.0-7.el6.centos             @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 redhat-lsb-core               x86_64           4.0-7.el6.centos             @anaconda-CentOS-201311272149.x86_64/6.5            22 k
 redhat-lsb-graphics           x86_64           4.0-7.el6.centos             @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 redhat-lsb-printing           x86_64           4.0-7.el6.centos             @anaconda-CentOS-201311272149.x86_64/6.5           0.0  
 sysstat                       x86_64           9.0.4-22.el6                 @anaconda-CentOS-201311272149.x86_64/6.5           824 k

Transaction Summary
======================================================================================================================================
Remove       11 Package(s)

Installed size: 15 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Erasing    : redhat-lsb-compat-4.0-7.el6.centos.x86_64                                                                         1/11
  Erasing    : redhat-lsb-4.0-7.el6.centos.x86_64                                                                                2/11
  Erasing    : redhat-lsb-graphics-4.0-7.el6.centos.x86_64                                                                       3/11
  Erasing    : redhat-lsb-printing-4.0-7.el6.centos.x86_64                                                                       4/11
  Erasing    : redhat-lsb-core-4.0-7.el6.centos.x86_64                                                                           5/11
  Erasing    : sysstat-9.0.4-22.el6.x86_64                                                                                       6/11
/var/tmp/rpm-tmp.3nhGx8: line 1: lsb_release: command not found
  Erasing    : crontabs-1.10-33.el6.noarch                                                                                       7/11
  Erasing    : cronie-anacron-1.4.4-12.el6.x86_64                                                                                8/11
  Erasing    : cronie-1.4.4-12.el6.x86_64                                                                                        9/11
  Erasing    : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                                 10/11
  Erasing    : mysql-libs-5.1.71-1.el6.x86_64                                                                                   11/11
  Verifying  : redhat-lsb-printing-4.0-7.el6.centos.x86_64                                                                       1/11
  Verifying  : cronie-anacron-1.4.4-12.el6.x86_64                                                                                2/11
  Verifying  : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                                  3/11
  Verifying  : redhat-lsb-4.0-7.el6.centos.x86_64                                                                                4/11
  Verifying  : redhat-lsb-core-4.0-7.el6.centos.x86_64                                                                           5/11
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                                                                                    6/11
  Verifying  : crontabs-1.10-33.el6.noarch                                                                                       7/11
  Verifying  : redhat-lsb-compat-4.0-7.el6.centos.x86_64                                                                         8/11
  Verifying  : sysstat-9.0.4-22.el6.x86_64                                                                                       9/11
  Verifying  : cronie-1.4.4-12.el6.x86_64                                                                                       10/11
  Verifying  : redhat-lsb-graphics-4.0-7.el6.centos.x86_64                                                                      11/11

Removed:
  mysql-libs.x86_64 0:5.1.71-1.el6                                                                                                    

Dependency Removed:
  cronie.x86_64 0:1.4.4-12.el6                                      cronie-anacron.x86_64 0:1.4.4-12.el6                             
  crontabs.noarch 0:1.10-33.el6                                     postfix.x86_64 2:2.6.6-2.2.el6_1                                 
  redhat-lsb.x86_64 0:4.0-7.el6.centos                              redhat-lsb-compat.x86_64 0:4.0-7.el6.centos                      
  redhat-lsb-core.x86_64 0:4.0-7.el6.centos                         redhat-lsb-graphics.x86_64 0:4.0-7.el6.centos                    
  redhat-lsb-printing.x86_64 0:4.0-7.el6.centos                     sysstat.x86_64 0:9.0.4-22.el6                                    

Complete!
[root@host2 ~]#

3
查验,这样删的彻底
[root@host2 ~]# find / -name mysql
[root@host2 ~]# find / -name *mysql*
[root@host2 ~]#

4
增加mysql用户和组
#useradd -r参数表示mysql用户是系统用户,不可用于登录系统。
[root@host2 backup]# groupadd mysql
[root@host2 backup]# useradd -r -g mysql mysql
[root@host2 backup]# id mysql
uid=495(mysql) gid=501(mysql) groups=501(mysql)
[root@host2 backup]#

5
安装于/opt/mysql-5.6.22-linux-glibc2.5-x86_64下
解压出来的文件夹名就是mysql-5.6.22-linux-glibc2.5-x86_64
[root@host2 backup]# cd /opt/
[root@host2 opt]#
[root@host2 opt]# tar -zxvf /root/backup/mysql-5.6.22-linux-glibc2.5-x86_64.tar.gz

安装于/usr/local/mysql-5.6.22-linux-glibc2.5-x86_64下
解压出来的文件夹名就是mysql-5.6.22-linux-glibc2.5-x86_64
[root@host2 backup]# cd /usr/local/
[root@host2 local]# tar -zxvf /root/backup/mysql-5.6.22-linux-glibc2.5-x86_64.tar.gz

看一下解压出来到目录,相对于rpm包安装,这个感觉更清爽一些,文件都在一个目录下,生产上另行考虑数据所在
[root@host2 local]# ls
bin  etc  games  include  lib  lib64  libexec  mysql-5.6.22-linux-glibc2.5-x86_64  sbin  share  src
[root@host2 local]# ls mysql-5.6.22-linux-glibc2.5-x86_64/
bin  COPYING  data  docs  include  INSTALL-BINARY  lib  man  mysql-test  README  scripts  share  sql-bench  support-files
[root@host2 local]#

6
名字太长,建个符号链接mysql方便
[root@host2 local]# ln -s mysql-5.6.22-linux-glibc2.5-x86_64/ mysql
[root@host2 local]# ls
bin  etc  games  include  lib  lib64  libexec  mysql  mysql-5.6.22-linux-glibc2.5-x86_64  sbin  share  src
[root@host2 local]#

7

 /usr/local/mysql/下的目录结构

Table 2.3 MySQLInstallation Layout for Generic Unix/Linux Binary Package

Directory

Contentsof Directory

bin

Clientprograms and the mysqldserver

data

Logfiles, databases

docs

Manualin Info format

man

Unixmanual pages

include

Include(header) files

lib

Libraries

scripts

mysql_install_db

share

Miscellaneoussupport files, including error messages, sample configurationfiles, SQL for database installation

sql-bench

Benchmarks




8
修改数据库文件和日志文件所在目录到属主和属组
[root@host2 mysql]# chown -R mysql:mysql data
[root@host2 mysql]#
[root@host2 mysql]#
[root@host2 mysql]# ll
total 168
drwxr-xr-x.  2 root  root    4096 Jan 20 14:46 bin
-rw-r--r--.  1  7161 wheel  17987 Nov 21 13:39 COPYING
drwxr-xr-x.  3 mysql mysql   4096 Jan 20 14:46 data
drwxr-xr-x.  2 root  root    4096 Jan 20 14:46 docs
drwxr-xr-x.  3 root  root    4096 Jan 20 14:45 include
-rw-r--r--.  1  7161 wheel 101760 Nov 21 13:40 INSTALL-BINARY
drwxr-xr-x.  3 root  root    4096 Jan 20 14:46 lib
drwxr-xr-x.  4 root  root    4096 Jan 20 14:46 man
drwxr-xr-x. 10 root  root    4096 Jan 20 14:46 mysql-test
-rw-r--r--.  1  7161 wheel   2496 Nov 21 13:39 README
drwxr-xr-x.  2 root  root    4096 Jan 20 14:46 scripts
drwxr-xr-x. 28 root  root    4096 Jan 20 14:46 share
drwxr-xr-x.  4 root  root    4096 Jan 20 14:46 sql-bench
drwxr-xr-x.  2 root  root    4096 Jan 20 14:46 support-files
[root@host2 mysql]#

[root@host2 mysql]# ll data/
total 4
drwxr-xr-x. 2 mysql mysql 4096 Jan 20 14:46 test

[root@host2 mysql]# ll data/test/
total 4
-rw-r--r--. 1 mysql mysql 65 Nov 21 13:39 db.opt
[root@host2 mysql]#

9
创建MySQL Server系统表
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# scripts/mysql_install_db --help
Usage: scripts/mysql_install_db [OPTIONS]
  --basedir=path       The path to the MySQL installation directory.
  --builddir=path      If using --srcdir with out-of-directory builds, you
                       will need to set this to the location of the build
                       directory where built files reside.
  --cross-bootstrap    For internal use.  Used when building the MySQL system
                       tables on a different host than the target.
  --datadir=path       The path to the MySQL data directory.
                       If missing, the directory will be created, but its
                       parent directory must already exist and be writable.
  --defaults-extra-file=name
                       Read this file after the global files are read.
  --defaults-file=name Only read default options from the given file name.
  --force              Causes mysql_install_db to run even if DNS does not
                       work.  In that case, grant table entries that normally
                       use hostnames will use IP addresses.
  --help               Display this help and exit.                     
  --ldata=path         The path to the MySQL data directory. Same as --datadir.
  --no-defaults        Don't read default options from any option file.
  --keep-my-cnf        Don't try to create my.cnf based on template.
                       Useful for systems with working, updated my.cnf.
                       Deprecated, will be removed in future version.
  --random-passwords   Create and set a random password for all root accounts
                       and set the "password expired" flag,
                       also remove the anonymous accounts.
  --rpm                For internal use.  This option is used by RPM files
                       during the MySQL installation process.
  --skip-name-resolve  Use IP addresses rather than hostnames when creating
                       grant table entries.  This option can be useful if
                       your DNS does not work.
  --srcdir=path        The path to the MySQL source directory.  This option
                       uses the compiled binaries and support files within the
                       source tree, useful for if you don't want to install
                       MySQL yet and just want to create the system tables.
  --user=user_name     The login username to use for running mysqld.  Files
                       and directories created by mysqld will be owned by this
                       user.  You must be root to use this option.  By default
                       mysqld runs using your current login name and files and
                       directories that it creates will be owned by you.
Any other options are passed to the mysqld program.

[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#

创建MySQL Server系统表
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# scripts/mysql_install_db --user=mysql
WARNING: The host 'host2' could not be looked up with ./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...2015-01-20 16:11:20 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-20 16:11:20 4325 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-01-20 16:11:20 4325 [Note] InnoDB: The InnoDB memory heap is disabled
2015-01-20 16:11:20 4325 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-01-20 16:11:20 4325 [Note] InnoDB: Memory barrier is not used
2015-01-20 16:11:20 4325 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-01-20 16:11:20 4325 [Note] InnoDB: Using Linux native AIO
2015-01-20 16:11:20 4325 [Note] InnoDB: Not using CPU crc32 instructions
2015-01-20 16:11:20 4325 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-01-20 16:11:20 4325 [Note] InnoDB: Completed initialization of buffer pool
2015-01-20 16:11:20 4325 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-01-20 16:11:20 4325 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-01-20 16:11:20 4325 [Note] InnoDB: Database physically writes the file full: wait...
2015-01-20 16:11:20 4325 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-01-20 16:11:21 4325 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-01-20 16:11:21 4325 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-01-20 16:11:21 4325 [Warning] InnoDB: New log files created, LSN=45781
2015-01-20 16:11:21 4325 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-01-20 16:11:21 4325 [Note] InnoDB: Doublewrite buffer created
2015-01-20 16:11:21 4325 [Note] InnoDB: 128 rollback segment(s) are active.
2015-01-20 16:11:21 4325 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-01-20 16:11:21 4325 [Note] InnoDB: Foreign key constraint system tables created
2015-01-20 16:11:21 4325 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-01-20 16:11:21 4325 [Note] InnoDB: Tablespace and datafile system tables created.
2015-01-20 16:11:21 4325 [Note] InnoDB: Waiting for purge to start
2015-01-20 16:11:21 4325 [Note] InnoDB: 5.6.22 started; log sequence number 0
2015-01-20 16:11:22 4325 [Note] Binlog end
2015-01-20 16:11:22 4325 [Note] InnoDB: FTS optimize thread exiting.
2015-01-20 16:11:22 4325 [Note] InnoDB: Starting shutdown...
2015-01-20 16:11:24 4325 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2015-01-20 16:11:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-20 16:11:24 4347 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-01-20 16:11:24 4347 [Note] InnoDB: The InnoDB memory heap is disabled
2015-01-20 16:11:24 4347 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-01-20 16:11:24 4347 [Note] InnoDB: Memory barrier is not used
2015-01-20 16:11:24 4347 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-01-20 16:11:24 4347 [Note] InnoDB: Using Linux native AIO
2015-01-20 16:11:24 4347 [Note] InnoDB: Not using CPU crc32 instructions
2015-01-20 16:11:24 4347 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-01-20 16:11:24 4347 [Note] InnoDB: Completed initialization of buffer pool
2015-01-20 16:11:24 4347 [Note] InnoDB: Highest supported file format is Barracuda.
2015-01-20 16:11:24 4347 [Note] InnoDB: 128 rollback segment(s) are active.
2015-01-20 16:11:24 4347 [Note] InnoDB: Waiting for purge to start
2015-01-20 16:11:24 4347 [Note] InnoDB: 5.6.22 started; log sequence number 1625977
2015-01-20 16:11:24 4347 [Note] Binlog end
2015-01-20 16:11:24 4347 [Note] InnoDB: FTS optimize thread exiting.
2015-01-20 16:11:24 4347 [Note] InnoDB: Starting shutdown...
2015-01-20 16:11:26 4347 [Note] InnoDB: Shutdown completed; log sequence number 1625987
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:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h host2 password 'new-password'

Alternatively you can run:

  ./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 . ; ./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 ./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@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#

10
复制配置文件
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# ll support-files/
total 32
-rwxr-xr-x. 1 7161 wheel  1153 Nov 21 14:02 binary-configure
-rw-r--r--. 1 7161 wheel   773 Nov 21 13:39 magic
-rw-r--r--. 1 7161 wheel  1126 Nov 21 14:02 my-default.cnf
-rwxr-xr-x. 1 7161 wheel  1061 Nov 21 14:02 mysqld_multi.server
-rwxr-xr-x. 1 7161 wheel   894 Nov 21 14:02 mysql-log-rotate
-rwxr-xr-x. 1 7161 wheel 10880 Nov 21 14:02 mysql.server
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# find / -name my-medium.cnf
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# cp support-files/my-default.cnf /etc/my.cnf
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#

11
配置mysqld启动脚本
将scripts/mysql.server服务脚本复制到/etc/init.d/,并重命名为mysqld。
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# cp support-files/mysql.server /etc/init.d/mysqld
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# ll /etc/init.d/mysqld
-rwxr-xr-x. 1 root root 10880 Jan 20 16:27 /etc/init.d/mysqld

12
启动mysql
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# ps -ef | grep mysql
root      4440  2326  0 16:29 pts/0    00:00:00 grep mysql
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# /etc/init.d/mysqld status
 ERROR! MySQL is not running
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# ps -ef | grep mysql
root      4455     1  0 16:29 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/host2.pid
mysql     4570  4455  3 16:29 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/host2.err --pid-file=/usr/local/mysql/data/host2.pid
root      4596  2326  0 16:30 pts/0    00:00:00 grep mysql
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#

13
测试:
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.22 MySQL Community Server (GPL)

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> \q
Bye

14
配置环境变量
在/etc/profile最后加入两行:

# add
MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin

[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# source /root/.bash_profile
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]#

15
验证
[root@host2 mysql-5.6.22-linux-glibc2.5-x86_64]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.22 MySQL Community Server (GPL)

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> \q
Bye

附:
安装后的部分目录内容:
[root@host2 mysql]# ll bin/
total 550160
-rwxr-xr-x. 1 7161 wheel  4705775 Nov 21 14:02 innochecksum
-rwxr-xr-x. 1 7161 wheel     1551 Nov 21 14:02 msql2mysql
-rwxr-xr-x. 1 7161 wheel  7128252 Nov 21 14:03 myisamchk
-rwxr-xr-x. 1 7161 wheel  6719073 Nov 21 14:03 myisam_ftdump
-rwxr-xr-x. 1 7161 wheel  6606805 Nov 21 14:03 myisamlog
-rwxr-xr-x. 1 7161 wheel  6803996 Nov 21 14:03 myisampack
-rwxr-xr-x. 1 7161 wheel  4646150 Nov 21 14:02 my_print_defaults
-rwxr-xr-x. 1 7161 wheel  8986555 Nov 21 14:03 mysql
-rwxr-xr-x. 1 7161 wheel   111803 Nov 21 14:02 mysqlaccess
-rwxr-xr-x. 1 7161 wheel     1702 Nov 21 14:02 mysqlaccess.conf
-rwxr-xr-x. 1 7161 wheel  8019633 Nov 21 14:03 mysqladmin
-rwxr-xr-x. 1 7161 wheel  8811724 Nov 21 14:03 mysqlbinlog
-rwxr-xr-x. 1 7161 wheel    11036 Nov 21 14:02 mysqlbug
-rwxr-xr-x. 1 7161 wheel  7996925 Nov 21 14:03 mysqlcheck
-rwxr-xr-x. 1 7161 wheel  9046172 Nov 21 14:03 mysql_client_test
-rwxr-xr-x. 1 7161 wheel 73808289 Nov 21 14:05 mysql_client_test_embedded
-rwxr-xr-x. 1 7161 wheel     6567 Nov 21 14:02 mysql_config
-rwxr-xr-x. 1 7161 wheel  7223668 Nov 21 14:03 mysql_config_editor
-rwxr-xr-x. 1 7161 wheel     4334 Nov 21 14:02 mysql_convert_table_format
-rwxr-xr-x. 1 7161 wheel 78288287 Nov 21 14:04 mysqld
-rwxr-xr-x. 1 7161 wheel 99400096 Nov 21 14:02 mysqld-debug
-rwxr-xr-x. 1 7161 wheel    26543 Nov 21 14:02 mysqld_multi
-rwxr-xr-x. 1 7161 wheel    24805 Nov 21 14:02 mysqld_safe
-rwxr-xr-x. 1 7161 wheel  8232475 Nov 21 14:03 mysqldump
-rwxr-xr-x. 1 7161 wheel     7424 Nov 21 14:02 mysqldumpslow
-rwxr-xr-x. 1 7161 wheel 73626428 Nov 21 14:05 mysql_embedded
-rwxr-xr-x. 1 7161 wheel     3409 Nov 21 14:02 mysql_find_rows
-rwxr-xr-x. 1 7161 wheel     1366 Nov 21 14:02 mysql_fix_extensions
-rwxr-xr-x. 1 7161 wheel    34938 Nov 21 14:02 mysqlhotcopy
-rwxr-xr-x. 1 7161 wheel  8010032 Nov 21 14:03 mysqlimport
-rwxr-xr-x. 1 7161 wheel  4691064 Nov 21 14:03 mysql_plugin
-rwxr-xr-x. 1 7161 wheel    10106 Nov 21 14:02 mysql_secure_installation
-rwxr-xr-x. 1 7161 wheel    17584 Nov 21 14:02 mysql_setpermission
-rwxr-xr-x. 1 7161 wheel  7989438 Nov 21 14:03 mysqlshow
-rwxr-xr-x. 1 7161 wheel  8064082 Nov 21 14:03 mysqlslap
-rwxr-xr-x. 1 7161 wheel  8652708 Nov 21 14:03 mysqltest
-rwxr-xr-x. 1 7161 wheel 73138808 Nov 21 14:04 mysqltest_embedded
-rwxr-xr-x. 1 7161 wheel  4375499 Nov 21 14:02 mysql_tzinfo_to_sql
-rwxr-xr-x. 1 7161 wheel  4845444 Nov 21 14:03 mysql_upgrade
-rwxr-xr-x. 1 7161 wheel  4643274 Nov 21 14:02 mysql_waitpid
-rwxr-xr-x. 1 7161 wheel     3976 Nov 21 14:02 mysql_zap
-rwxr-xr-x. 1 7161 wheel  4754423 Nov 21 14:03 perror
-rwxr-xr-x. 1 7161 wheel  4495210 Nov 21 14:02 replace
-rwxr-xr-x. 1 7161 wheel  4644978 Nov 21 14:02 resolveip
-rwxr-xr-x. 1 7161 wheel  4652553 Nov 21 14:02 resolve_stack_dump
[root@host2 mysql]# ll
total 168
drwxr-xr-x.  2 root root    4096 Jan 20 14:46 bin
-rw-r--r--.  1 7161 wheel  17987 Nov 21 13:39 COPYING
drwxr-xr-x.  3 root root    4096 Jan 20 14:46 data
drwxr-xr-x.  2 root root    4096 Jan 20 14:46 docs
drwxr-xr-x.  3 root root    4096 Jan 20 14:45 include
-rw-r--r--.  1 7161 wheel 101760 Nov 21 13:40 INSTALL-BINARY
drwxr-xr-x.  3 root root    4096 Jan 20 14:46 lib
drwxr-xr-x.  4 root root    4096 Jan 20 14:46 man
drwxr-xr-x. 10 root root    4096 Jan 20 14:46 mysql-test
-rw-r--r--.  1 7161 wheel   2496 Nov 21 13:39 README
drwxr-xr-x.  2 root root    4096 Jan 20 14:46 scripts
drwxr-xr-x. 28 root root    4096 Jan 20 14:46 share
drwxr-xr-x.  4 root root    4096 Jan 20 14:46 sql-bench
drwxr-xr-x.  2 root root    4096 Jan 20 14:46 support-files
[root@host2 mysql]# ll share/
total 1472
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 aclocal
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 bulgarian
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 charsets
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 czech
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 danish
-rw-r--r--. 1 7161 wheel  25575 Nov 21 13:39 dictionary.txt
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 dutch
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 english
-rw-r--r--. 1 7161 wheel 505241 Nov 21 13:39 errmsg-utf8.txt
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 estonian
-rw-r--r--. 1 7161 wheel 742787 Nov 21 13:40 fill_help_tables.sql
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 french
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 german
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 greek
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 hungarian
-rw-r--r--. 1 7161 wheel   3963 Nov 21 13:39 innodb_memcached_config.sql
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 italian
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 japanese
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 korean
-rw-r--r--. 1 7161 wheel   1695 Nov 21 13:39 mysql_security_commands.sql
-rw-r--r--. 1 7161 wheel   3464 Nov 21 13:39 mysql_system_tables_data.sql
-rw-r--r--. 1 7161 wheel  93220 Nov 21 13:39 mysql_system_tables.sql
-rw-r--r--. 1 7161 wheel  10410 Nov 21 13:39 mysql_test_data_timezone.sql
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 norwegian
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 norwegian-ny
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 polish
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 portuguese
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 romanian
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 russian
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 serbian
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 slovak
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 spanish
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 swedish
drwxr-xr-x. 2 root root    4096 Jan 20 14:46 ukrainian
[root@host2 mysql]#
[root@host2 mysql]#
[root@host2 mysql]#
[root@host2 mysql]# cat /etc/shadow | grep 7161
[root@host2 mysql]# cat /etc/group | grep wheel
wheel:x:10:
[root@host2 mysql]# cat /etc/passwd | grep 7161
[root@host2 mysql]#



参考

http://dev.mysql.com/doc/refman/5.6/en/installing.html



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

转载请著明出处:
blog.csdn.net/beiigang
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值