7564321 发表于 2016-12-19 12:52:08

二进制安装MySQL

环境说明:

系统版本Red Hat Enterprise Linux Server release 5.9
MySQL版本mysql-5.7.16

官网下载二进制安装包,因为我的系统为32位,所以我下载的为32位的二进制包:mysql-5.7.16-linux-glibc2.5-i686.tar

开始安装:


[*]建立mysql用户
# groupadd mysql
# useradd -g mysql -s /sbin/nologon -r mysql
[*]拷贝二进制包到安装目录
# cp mysql-5.7.16-linux-glibc2.5-i686.tar /usr/local/
# cd /usr/local/
# tar xvf mysql-5.7.16-linux-glibc2.5-i686.tar      --解压官网下载的二进制包,得到以下两个压缩包
mysql-5.7.16-linux-glibc2.5-i686.tar.gz      --二进制完整包         
mysql-test-5.7.16-linux-glibc2.5-i686.tar.gz      --二进制测试版本包
# tar -zxvf mysql-5.7.16-linux-glibc2.5-i686.tar.gz      --解压二进制完整包,得到mysql-5.7.16-linux-glibc2.5-i686目录
[*]建立安装目录
# ln -s mysql-5.7.16-linux-glibc2.5-i686 mysql
# chown mysql.mysql mysql      --改变mysql目录所有者及所属组
[*]初始化mysql
# ./bin/mysqld --initialize --user=mysql
2016-12-15T14:51:02.940897Z 0 TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-15T14:51:04.980370Z 0 InnoDB: New log files created, LSN=45790
2016-12-15T14:51:06.472499Z 0 InnoDB: Creating foreign key constraint system tables.
2016-12-15T14:51:06.818552Z 0 No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: e8a2ce20-c2d5-11e6-8600-000c29c0c548.
2016-12-15T14:51:06.832209Z 0 Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-12-15T14:51:06.897435Z 1 A temporary password is generated for root@localhost: 1rgGTq+1+fhX      --绿色底1rgGTq+1+fhX为初始化生产的登录密码
[*]启动mysql
# bin/mysqld --user=mysql &
17811
# 2016-12-15T16:04:32.813992Z 0 TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-15T16:04:32.814400Z 0 --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2016-12-15T16:04:32.814443Z 0 bin/mysqld (mysqld 5.7.16) starting as process 17811 ...
2016-12-15T16:04:32.926963Z 0 InnoDB: PUNCH HOLE support not available
2016-12-15T16:04:32.927445Z 0 InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-12-15T16:04:32.927618Z 0 InnoDB: Uses event mutexes
2016-12-15T16:04:32.927773Z 0 InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-12-15T16:04:32.927885Z 0 InnoDB: Compressed tables use zlib 1.2.3
2016-12-15T16:04:32.928011Z 0 InnoDB: Using Linux native AIO
2016-12-15T16:04:32.929080Z 0 InnoDB: Number of pools: 1
2016-12-15T16:04:32.929596Z 0 InnoDB: Not using CPU crc32 instructions
2016-12-15T16:04:32.949144Z 0 InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-12-15T16:04:32.968546Z 0 InnoDB: Completed initialization of buffer pool
2016-12-15T16:04:32.971367Z 0 InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-12-15T16:04:32.994919Z 0 InnoDB: Highest supported file format is Barracuda.
2016-12-15T16:04:33.253483Z 0 InnoDB: Creating shared tablespace for temporary tables
2016-12-15T16:04:33.253977Z 0 InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-12-15T16:04:34.471905Z 0 InnoDB: File './ibtmp1' size is now 12 MB.
2016-12-15T16:04:34.478040Z 0 InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-12-15T16:04:34.478461Z 0 InnoDB: 32 non-redo rollback segment(s) are active.
2016-12-15T16:04:34.479541Z 0 InnoDB: Waiting for purge to start
2016-12-15T16:04:34.639008Z 0 InnoDB: 5.7.16 started; log sequence number 2532972
2016-12-15T16:04:34.641320Z 0 InnoDB: Loading buffer pool(s) from /usr/local/mysql-5.7.16-linux-glibc2.5-i686/data/ib_buffer_pool
2016-12-15T16:04:34.644631Z 0 Plugin 'FEDERATED' is disabled.
2016-12-15T16:04:35.640122Z 0 Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-12-15T16:04:35.658540Z 0 Server hostname (bind-address): '*'; port: 3306
2016-12-15T16:04:35.658940Z 0 IPv6 is available.
2016-12-15T16:04:35.659073Z 0    - '::' resolves to '::';
2016-12-15T16:04:35.659518Z 0 Server socket created on IP: '::'.
2016-12-15T16:04:35.726880Z 0 InnoDB: Buffer pool(s) load completed at 1612160:04:35
2016-12-15T16:04:36.111141Z 0 Event Scheduler: Loaded 0 events
2016-12-15T16:04:36.112045Z 0 bin/mysqld: ready for connections.
Version: '5.7.16'socket: '/tmp/mysql.sock'port: 3306MySQL Community Server (GPL)
检查:
# ps -aux | grep mysql
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
mysql    178112.6 60.2 602048 153728 pts/0   Sl   00:04   0:00 bin/mysqld --user=mysql      --mysql启动成功
root   178690.00.2   4032   684 pts/1    R+   00:05   0:00 grep mysql
[*]登录mysql并验证


注意:首次登录需要更改密码。

(备注:笔者整理此文时,正在知数堂跟随叶金荣、吴炳锡两位MySQL大神学习,本文知识源于两位老师所授)



页: [1]
查看完整版本: 二进制安装MySQL