您现在的位置是:网站首页 > 代码编程 > 服务器服务器

【原】linux环境下mysql5.6二进制方式安装教程

不忘初心 不忘初心 2017-10-13 围观() 评论() 点赞() 服务器

简介:前面的文章中,讲过了mysql5.5的安装,虽然mysql5.6是个坑货,但是作为一个中间版本,承上启下,还是决定写一篇安装教程。mysql5.6的安装,与mysql5.5极其相似,除了一些依赖库不一样,其他都一模一样。开始的步骤还是一样,已经在 mysql5.7的安装 和 mysql5.5的安装 中讲过了,这里不再重复[root@jdu4e00u53f7soft]#wgethttps://dev

前面的文章中,讲过了mysql5.5的安装,虽然mysql5.6是个坑货,但是作为一个中间版本,承上启下,还是决定写一篇安装教程。

mysql5.6的安装,与mysql5.5极其相似,除了一些依赖库不一样,其他都一模一样。

开始的步骤还是一样,已经在 mysql5.7的安装 和 mysql5.5的安装 中讲过了,这里不再重复

[root@jdu4e00u53f7 soft]# wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz
[root@jdu4e00u53f7 soft]# tar -zxvf mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz
[root@jdu4e00u53f7 soft]# cd /usr/local/mysql/
[root@jdu4e00u53f7 mysql]# groupadd mysql
[root@jdu4e00u53f7 mysql]# useradd -r -g mysql mysql
[root@jdu4e00u53f7 mysql]# chown -R mysql:mysql /usr/local/mysql
[root@jdu4e00u53f7 mysql]# export PATH=/usr/local/mysql/bin:$PATH

依旧是执行 mysql_install_db 来安装db文件,目录结构与mysql5.5一模一样。

执行安装脚本,但是这里却报错了,缺失各种依赖,这就显示出来和mysql5.5的一些差别了

[root@jdu4e00u53f7 mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

缺失了perl库,不管三七二十一,直接yum一个

[root@jdu4e00u53f7 mysql]# yum install -y perl perl-devel

再次执行安装脚本

[root@jdu4e00u53f7 mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper

不知道dumper是个什么东西,查阅资料发现,是缺失了autoconf库

[root@jdu4e00u53f7 mysql]# yum install -y autoconf

再次执行安装脚本

[root@jdu4e00u53f7 mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
Installing MySQL system tables.../usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

是不是很眼熟?缺失libaio.so,在安装5.7时已经提到过,我们直接yum install一个

[root@jdu4e00u53f7 mysql]# yum install -y libaio

安装好了libaio之后,再来执行安装脚本

[root@jdu4e00u53f7 mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
Installing MySQL system tables...2017-10-13 14:58:48 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-10-13 14:58:48 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2017-10-13 14:58:48 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.37) starting as process 24425 ...
2017-10-13 14:58:48 24425 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-10-13 14:58:48 24425 [Note] InnoDB: The InnoDB memory heap is disabled
2017-10-13 14:58:48 24425 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-10-13 14:58:48 24425 [Note] InnoDB: Memory barrier is not used
2017-10-13 14:58:48 24425 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-10-13 14:58:48 24425 [Note] InnoDB: Using Linux native AIO
2017-10-13 14:58:48 24425 [Note] InnoDB: Using CPU crc32 instructions
2017-10-13 14:58:48 24425 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-10-13 14:58:48 24425 [Note] InnoDB: Completed initialization of buffer pool
2017-10-13 14:58:48 24425 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-10-13 14:58:48 24425 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2017-10-13 14:58:48 24425 [Note] InnoDB: Database physically writes the file full: wait...
2017-10-13 14:58:48 24425 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2017-10-13 14:58:49 24425 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2017-10-13 14:58:49 24425 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2017-10-13 14:58:49 24425 [Warning] InnoDB: New log files created, LSN=45781
2017-10-13 14:58:49 24425 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-10-13 14:58:49 24425 [Note] InnoDB: Doublewrite buffer created
2017-10-13 14:58:49 24425 [Note] InnoDB: 128 rollback segment(s) are active.
2017-10-13 14:58:49 24425 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-10-13 14:58:49 24425 [Note] InnoDB: Foreign key constraint system tables created
2017-10-13 14:58:49 24425 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-10-13 14:58:49 24425 [Note] InnoDB: Tablespace and datafile system tables created.
2017-10-13 14:58:49 24425 [Note] InnoDB: Waiting for purge to start
2017-10-13 14:58:49 24425 [Note] InnoDB: 5.6.37 started; log sequence number 0
2017-10-13 14:58:49 24425 [Note] Binlog end
2017-10-13 14:58:49 24425 [Note] InnoDB: FTS optimize thread exiting.
2017-10-13 14:58:49 24425 [Note] InnoDB: Starting shutdown...
2017-10-13 14:58:51 24425 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2017-10-13 14:58:51 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-10-13 14:58:51 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2017-10-13 14:58:51 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.37) starting as process 24448 ...
2017-10-13 14:58:51 24448 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-10-13 14:58:51 24448 [Note] InnoDB: The InnoDB memory heap is disabled
2017-10-13 14:58:51 24448 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-10-13 14:58:51 24448 [Note] InnoDB: Memory barrier is not used
2017-10-13 14:58:51 24448 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-10-13 14:58:51 24448 [Note] InnoDB: Using Linux native AIO
2017-10-13 14:58:51 24448 [Note] InnoDB: Using CPU crc32 instructions
2017-10-13 14:58:51 24448 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-10-13 14:58:51 24448 [Note] InnoDB: Completed initialization of buffer pool
2017-10-13 14:58:51 24448 [Note] InnoDB: Highest supported file format is Barracuda.
2017-10-13 14:58:51 24448 [Note] InnoDB: 128 rollback segment(s) are active.
2017-10-13 14:58:51 24448 [Note] InnoDB: Waiting for purge to start
2017-10-13 14:58:51 24448 [Note] InnoDB: 5.6.37 started; log sequence number 1625977
2017-10-13 14:58:51 24448 [Note] Binlog end
2017-10-13 14:58:51 24448 [Note] InnoDB: FTS optimize thread exiting.
2017-10-13 14:58:51 24448 [Note] InnoDB: Starting shutdown...
2017-10-13 14:58:53 24448 [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:

  /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql/bin/mysqladmin -u root -h jdu4e00u53f7 password 'new-password'

Alternatively you can run:

  /usr/local/mysql/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 . ; /usr/local/mysql/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

WARNING: Found existing config file /usr/local/mysql/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/local/mysql/my-new.cnf,
please compare it with your file and take the changes you need.

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

执行细节跟mysql5.5大同小异,查看data文件夹,生成了很多系统文件

[root@jdu4e00u53f7 mysql]# ll data
total 110616
-rw-rw---- 1 mysql mysql       56 Oct 13 15:17 auto.cnf
-rw-rw---- 1 mysql mysql 12582912 Oct 13 15:17 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Oct 13 15:17 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Oct 13 14:58 ib_logfile1
-rw-rw---- 1 mysql mysql    10768 Oct 13 15:17 jdu4e00u53f7.err
drwx------ 2 mysql mysql     4096 Oct 13 14:58 mysql
drwx------ 2 mysql mysql     4096 Oct 13 14:58 performance_schema
drwxr-xr-x 2 mysql mysql       20 Oct 13 10:37 test

install_db之后,生成了两个配置文件 my.cnf 和 my-new.cnf(内容格式都一模一样),神奇了,在mysql5.5中都没有自动生成,怪哉,怪哉

linux环境下mysql5.6二进制方式安装教程

如上图,两个文件,我们只需要挑选其中一个使用,习惯性使用my.cnf

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

basedir = /usr/local/mysql
datadir = /usr/local/mysql/data

innodb_file_per_table = 1

#skip-grant-tables = 1

接下来的几个步骤也是一样

[root@jdu4e00u53f7 mysql]# cp my.cnf /etc/my.cnf
[root@jdu4e00u53f7 mysql]# ./support-files/mysql.server start
Starting MySQL.. SUCCESS! 
[root@jdu4e00u53f7 mysql]# ./support-files/mysql.server stop
Shutting down MySQL. SUCCESS! 
[root@jdu4e00u53f7 mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@jdu4e00u53f7 mysql]# service mysql start
Starting MySQL. SUCCESS! 
[root@jdu4e00u53f7 mysql]# service mysql stop
Shutting down MySQL.. SUCCESS!

mysql二进制mysql5.6linux mysql

看完文章,有任何疑问,请加入群聊一起交流!!!

很赞哦! ()

文章评论

  • 请先说点什么
    人参与,条评论

请使用电脑浏览器访问本页面,使用手机浏览器访问本页面会导致下载文件异常!!!

雨落无影

关注上方公众号,回复关键字【下载】获取下载码

用完即删,每次下载需重新获取下载码

若出现下载不了的情况,请及时联系站长进行解决

站点信息

  • 网站程序:spring + freemarker
  • 主题模板:《今夕何夕》
  • 文章统计:篇文章
  • 标签管理标签云
  • 微信公众号:扫描二维码,关注我们