环境说明:
系统版本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 [Warning] 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 [Warning] InnoDB: New log files created, LSN=45790
2016-12-15T14:51:06.472499Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-12-15T14:51:06.818552Z 0 [Warning] 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 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2016-12-15T14:51:06.897435Z 1 [Note] A temporary password is generated for root@localhost: 1rgGTq+1+fhX --绿色底1rgGTq+1+fhX为初始化生产的登录密码
启动mysql
# bin/mysqld --user=mysql &
[1] 17811
[root@lib2 mysql]# 2016-12-15T16:04:32.813992Z 0 [Warning] 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 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2016-12-15T16:04:32.814443Z 0 [Note] bin/mysqld (mysqld 5.7.16) starting as process 17811 ...
2016-12-15T16:04:32.926963Z 0 [Note] InnoDB: PUNCH HOLE support not available
2016-12-15T16:04:32.927445Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-12-15T16:04:32.927618Z 0 [Note] InnoDB: Uses event mutexes
2016-12-15T16:04:32.927773Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-12-15T16:04:32.927885Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-12-15T16:04:32.928011Z 0 [Note] InnoDB: Using Linux native AIO
2016-12-15T16:04:32.929080Z 0 [Note] InnoDB: Number of pools: 1
2016-12-15T16:04:32.929596Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2016-12-15T16:04:32.949144Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-12-15T16:04:32.968546Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-12-15T16:04:32.971367Z 0 [Note] 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 [Note] InnoDB: Highest supported file format is Barracuda.
2016-12-15T16:04:33.253483Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-12-15T16:04:33.253977Z 0 [Note] InnoDB: Setting file ‘./ibtmp1‘ size to 12 MB. Physically writing the file full; Please wait ...
2016-12-15T16:04:34.471905Z 0 [Note] InnoDB: File ‘./ibtmp1‘ size is now 12 MB.
2016-12-15T16:04:34.478040Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-12-15T16:04:34.478461Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-12-15T16:04:34.479541Z 0 [Note] InnoDB: Waiting for purge to start
2016-12-15T16:04:34.639008Z 0 [Note] InnoDB: 5.7.16 started; log sequence number 2532972
2016-12-15T16:04:34.641320Z 0 [Note] 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 [Note] Plugin ‘FEDERATED‘ is disabled.
2016-12-15T16:04:35.640122Z 0 [Warning] 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 [Note] Server hostname (bind-address): ‘*‘; port: 3306
2016-12-15T16:04:35.658940Z 0 [Note] IPv6 is available.
2016-12-15T16:04:35.659073Z 0 [Note] - ‘::‘ resolves to ‘::‘;
2016-12-15T16:04:35.659518Z 0 [Note] Server socket created on IP: ‘::‘.
2016-12-15T16:04:35.726880Z 0 [Note] InnoDB: Buffer pool(s) load completed at 161216 0:04:35
2016-12-15T16:04:36.111141Z 0 [Note] Event Scheduler: Loaded 0 events
2016-12-15T16:04:36.112045Z 0 [Note] bin/mysqld: ready for connections.
Version: ‘5.7.16‘ socket: ‘/tmp/mysql.sock‘ port: 3306 MySQL Community Server (GPL)
检查:
# ps -aux | grep mysql
Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.7/FAQ
mysql 17811 2.6 60.2 602048 153728 pts/0 Sl 00:04 0:00 bin/mysqld --user=mysql --mysql启动成功
root 17869 0.0 0.2 4032 684 pts/1 R+ 00:05 0:00 grep mysql
登录mysql并验证
注意:首次登录需要更改密码。
(备注:笔者整理此文时,正在知数堂跟随叶金荣、吴炳锡两位MySQL大神学习,本文知识源于两位老师所授)
本文出自 “aiIT” 博客,转载请与作者联系!
原文地址:http://songsong0119.blog.51cto.com/2234363/1883439