2.1 Installing MySQL on Linux Using the MySQL Yum Repository

指导文档:http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

[root@m01 software]# yum -y remove mysql-libs.x86_64

1.Adding the MySQL Yum Repository

a.下载mysql5.7 yum资源库(Download MySQL Yum Repository

网页下载:http://dev.mysql.com/downloads/repo/yum/

或者wget下载如下:

[root@m01 software]# wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

--2016-10-16 00:29:06--  http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

Resolving dev.mysql.com... 137.254.60.11

Connecting to dev.mysql.com|137.254.60.11|:80... connected.

HTTP request sent, awaiting response... 302 Found

Location: http://repo.mysql.com//mysql-community-release-el6-5.noarch.rpm [following]

--2016-10-16 00:29:08--  http://repo.mysql.com//mysql-community-release-el6-5.noarch.rpm

Resolving repo.mysql.com... 23.13.185.161

Connecting to repo.mysql.com|23.13.185.161|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 5824 (5.7K) [application/x-redhat-package-manager]

Saving to: mysql-community-release-el6-5.noarch.rpm

100%[======================================================================================================================>] 5,824       --.-K/s   in 0s

2016-10-16 00:29:18 (123 MB/s) - mysql-community-release-el6-5.noarch.rpmsaved [5824/5824]

b. 安装MySQL Yum Repository

[root@m01 software]# yum localinstall mysql-community-release-el6-5.noarch.rpm

Loaded plugins: product-id, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Setting up Local Package Process

Examining mysql-community-release-el6-5.noarch.rpm: mysql-community-release-el6-5.noarch

Marking mysql-community-release-el6-5.noarch.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-release.noarch 0:el6-5 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

Installing:

 mysql-community-release                    noarch                    el6-5                      /mysql-community-release-el6-5.noarch                    4.3 k

 

c.检查MySQL Yum Repository是否安装成功

[root@m01 software]# yum repolist all | grep mysql

Unable to read consumer identity

mysql-connectors-community        MySQL Connectors Community      enabled:    24

mysql-connectors-community-source MySQL Connectors Community - So disabled

mysql-tools-community             MySQL Tools Community           enabled:    38

mysql-tools-community-source      MySQL Tools Community - Source  disabled

mysql55-community                 MySQL 5.5 Community Server      disabled

mysql55-community-source          MySQL 5.5 Community Server - So disabled

mysql56-community                 MySQL 5.6 Community Server      enabled:   316

mysql56-community-source          MySQL 5.6 Community Server - So disabled

mysql57-community-dmr             MySQL 5.7 Community Server Deve disabled

mysql57-community-dmr-source      MySQL 5.7 Community Server Deve disabled

 

[root@m01 software]# yum repolist enabled | grep mysql

Unable to read consumer identity

mysql-connectors-community           MySQL Connectors Community              24

mysql-tools-community                MySQL Tools Community                   38

mysql56-community                    MySQL 5.6 Community Server             316

2.Selecting a Release Series

A.安装yum-config-manager

[root@m01 ~]# yum search yum-config-manager

Loaded plugins: product-id, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

================================================================= Matched: yum-config-manager ==================================================================

yum-utils.noarch : Utilities based around the yum package manager

[root@m01 ~]# yum install yum-utils

B.

[root@m01 ~]# yum-config-manager --disable mysql57-community

Loaded plugins: product-id

[root@m01 ~]# yum-config-manager --enable mysql56-community

Loaded plugins: product-id

=================================================================== repo: mysql56-community ====================================================================

[mysql56-community]

bandwidth = 0

base_persistdir = /var/lib/yum/repos/x86_64/6Server

baseurl = http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/

cache = 0

cachedir = /var/cache/yum/x86_64/6Server/mysql56-community

cost = 1000

enabled = True

enablegroups = True

....

 

[root@m01 ~]# yum repolist enabled | grep "mysql.*-community.*"

Unable to read consumer identity

mysql-connectors-community           MySQL Connectors Community              24

mysql-tools-community                MySQL Tools Community                   38

mysql56-community                    MySQL 5.6 Community Server             316

 

3.Installing MySQL

yum install mysql-community-server or

yum reinstall mysql-community-server

[root@m01 ~]# yum list installed | grep "^mysql"

Unable to read consumer identity

mysql-community-client.x86_64      5.6.34-2.el6              @mysql56-community

mysql-community-common.x86_64      5.6.34-2.el6              @mysql56-community

mysql-community-libs.x86_64        5.6.34-2.el6              @mysql56-community

mysql-community-release.noarch     el6-5                     @/mysql-community-release-el6-5.noarch

mysql-community-server.x86_64      5.6.34-2.el6              @mysql56-community

4.Starting the MySQL Server

[root@m01 ~]# service mysqld start

MySQL Daemon failed to start.

Starting mysqld:                                           [FAILED]

[root@m01 ~]# service mysqld status

mysqld is stopped

5.安装其他组件

yum --disablerepo=\* --enablerepo='mysql*-community*' list available

2.2 service mysqld start报错处理

1】查看日志

less /var/log/mysqld.log

2】日志报错

1.[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it

2.[Note] InnoDB: Not using CPU crc32 instructions

3.[ERROR] InnoDB: Could not open or create the system tablespace.

4.[ERROR] Plugin 'InnoDB' init function returned error

5.[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

3】使用mysqld  --user=root验证

2016-10-19 14:58:55 2631 [ERROR] Plugin 'InnoDB' init function returned error.

2016-10-19 14:58:55 2631 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

2016-10-19 14:58:55 2631 [ERROR] Unknown/unsupported storage engine: InnoDB

4】检查my.cnf

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

[root@m01 /]# find -name my.cnf

./software/mysql/my.cnf

./usr/my.cnf

./etc/my.cnf

 

[root@m01 /]# cat /etc/my.cnf | grep -v '#'

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

symbolic-links=0

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

 

 

 

5查看mysqld --verbose --help |less帮助

 mysqld --innodb=OFF --default-storage-engine=MyISAM  --user=root

 mysqld --skip-innodb --default-storage-engine=myisam --user=root

 

6】资料:


If you're using MySQL 5.6+ and want to disable InnoDB, don't forget "--default-tmp-storage" or it won't work:To disable InnoDB, use --innodb=OFF or --skip-innodb. In this case, because the default storage engine is InnoDB, the server will not start unless you also use --default-storage-engine and --default-tmp-storage-engine to set the default to some other engine for both permanent and TEMPORARY tables.

http://dev.mysql.com/doc/refman/5.6/en/innodb-parameters.html#option_mysqld_ignore-builtin-innodb

You can add this to your my.cnf:

[mysqld]

innodb=OFF

ignore-builtin-innodb

skip-innodb

default-storage-engine=myisam

default-tmp-storage-engine=myisam

 

2.3 Installing MySQL on Unix/Linux Using Generic Binaries


Warning

MySQL has a dependency on the libaio library. Data directory initialization and subsequent server startup steps will fail if this library is not installed locally. If necessary, install it using the appropriate package manager. For example, on Yum-based systems:

shell> yum search libaio  # search for info

shell> yum install libaio # install library

To install and use a MySQL binary distribution, the command sequence looks like this:

shell> groupadd mysql

shell> useradd -r -g mysql -s /bin/false mysql

shell> cd /usr/local

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

shell> mkdir mysql-files

shell> chmod 750 mysql-files

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> bin/mysql_install_db --user=mysql    # Before MySQL 5.7.6

shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up

shell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and up

shell> chown -R root .

shell> chown -R mysql data mysql-files

shell> bin/mysqld_safe --user=mysql &

# Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server

********************************************************************
** 欢迎转发,注明原文:blog.csdn.net/clark_xu   徐长亮的专栏
** 谢谢您的支持,欢迎关注微信公众号:clark_blog 
********************************************************************


GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐