RHEL 7.3 安装 MySQL 5.6 教程

MySQL 是最流行的关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司。
MySQL所使用的SQL语言是用于访问数据库的最常用标准化语言。
MySQL由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,一般中小型网站的开发都选择MySQL作为网站数据库。

二、准备

1、所需软件

mysql-5.6.34.tar.gz

下载地址:

2、所需环境

1)卸载自带 mysql

# yum -y remove mysql*

2)将原配置文件删除或改名

# mv /etc/my.cnf /etc/my.cnf.old

RHEL 7.3 安装 MySQL 5.6 教程

三、安装

1、配置yum源

1)将系统 rhel-server-7.3-x86_64-dvd.iso 文件拷贝到 /soft 目录下

# cp rhel-server-7.3-x86_64-dvd.iso /soft/

2)建立挂载所需的目录

# mkdir -p /media/cdrom

3)挂载
# mount -o loop /soft/rhel-server-7.3-x86_64-dvd.iso /media/cdrom

4)进入 /etc/yum.repo.d 目录,对yum 源进行设置
# cd /etc/yum.repo.d
# vi server.repo

5)查看是否安装成功,显示有4751 个软件包,源配置成功
# yum repolist

2、安装依赖

# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make cmake

RHEL 7.3 安装 MySQL 5.6 教程

3、创建用户和组

# groupadd -r mysql

# useradd -g mysql -r -d /mydata/data mysql

4、解压安装包

# tar zxvf mysql-5.6.34.tar.gz

5、编译

# cd mysql-5.6.34

# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

其他参考

# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql/ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_INNODB_MEMCACHED=1 -DWITH_DEBUG=OFF -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DENABLED_PROFILING=ON -DMYSQL_MAINTAINER_MODE=OFF -DMYSQL_DATADIR=/usr/local/webserver/mysql/data -DMYSQL_TCP_PORT=3306

 

6、安装

# make

# make install

7、查看是否安装成功

查看mysql版本

# /usr/local/mysql/bin/mysql --version

四、配置

1、更改 /usr/local/mysql 目录所属

# cd /usr/local

# chown -R mysql:mysql mysql

2、安装perl

# yum -y install perl*

3、初始化数据库

# mkdir -p /mydata/data

# cd /usr/local/mysql

# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/data

Installing MySQL system tables...2016-12-12 13:24:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-12 13:24:13 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2016-12-12 13:24:13 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.34) starting as process 4076 ...
2016-12-12 13:24:13 4076 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-12-12 13:24:13 4076 [Note] InnoDB: The InnoDB memory heap is disabled
2016-12-12 13:24:13 4076 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-12-12 13:24:13 4076 [Note] InnoDB: Memory barrier is not used
2016-12-12 13:24:13 4076 [Note] InnoDB: Compressed tables use zlib 1.2.7
2016-12-12 13:24:13 4076 [Note] InnoDB: Using CPU crc32 instructions
2016-12-12 13:24:13 4076 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-12-12 13:24:13 4076 [Note] InnoDB: Completed initialization of buffer pool
2016-12-12 13:24:13 4076 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-12-12 13:24:13 4076 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-12-12 13:24:13 4076 [Note] InnoDB: Database physically writes the file full: wait...
2016-12-12 13:24:13 4076 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-12-12 13:24:14 4076 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-12-12 13:24:16 4076 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-12-12 13:24:16 4076 [Warning] InnoDB: New log files created, LSN=45781
2016-12-12 13:24:16 4076 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-12-12 13:24:16 4076 [Note] InnoDB: Doublewrite buffer created
2016-12-12 13:24:16 4076 [Note] InnoDB: 128 rollback segment(s) are active.
2016-12-12 13:24:16 4076 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-12-12 13:24:16 4076 [Note] InnoDB: Foreign key constraint system tables created
2016-12-12 13:24:16 4076 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-12-12 13:24:16 4076 [Note] InnoDB: Tablespace and datafile system tables created.
2016-12-12 13:24:16 4076 [Note] InnoDB: Waiting for purge to start
2016-12-12 13:24:16 4076 [Note] InnoDB: 5.6.34 started; log sequence number 0
2016-12-12 13:24:16 4076 [Note] RSA private key file not found: /mydata/data//private_key.pem. Some authentication plugins will not work.
2016-12-12 13:24:16 4076 [Note] RSA public key file not found: /mydata/data//public_key.pem. Some authentication plugins will not work.
2016-12-12 13:24:19 4076 [Note] Binlog end
2016-12-12 13:24:19 4076 [Note] InnoDB: FTS optimize thread exiting.
2016-12-12 13:24:19 4076 [Note] InnoDB: Starting shutdown...
2016-12-12 13:24:19 4076 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/20bfee84036e053a384d76e3a262536f.html