CentOS6.6-64下rpm方式mysql-5.7.12安装实录

来源:互联网 发布:手机淘宝宝贝怎么分类 编辑:程序博客网 时间:2024/06/05 11:22
操作系统环境情况:
[root@localhost ~]# cat /etc/issue 
CentOS release 6.6 (Final)
Kernel \r on an \m
[root@localhost ~]# getconf LONG_BIT
64

1、mysql-5.7.12 rpm bundel包下载
[root@localhost ~]# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
--2016-04-22 08:04:46--  http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
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://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar [following]
--2016-04-22 08:04:46--  http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
Resolving cdn.mysql.com... 104.118.86.179
Connecting to cdn.mysql.com|104.118.86.179|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 457492480 (436M) [application/x-tar]
Saving to: “mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar”

100%[====================================================================================================================================================================================================================================>] 457,492,480  480K/s   in 14m 18s

2016-04-22 08:19:04 (521 KB/s) - “mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar” saved [457492480/457492480]

[root@localhost ~]# ll
total 691548
-rw-r--r--. 1 root root 457492480 Mar 29 01:53 mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar

2、解压缩mysql-bundle包
[root@localhost ~]# tar -xvf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
mysql-community-libs-5.7.12-1.el6.x86_64.rpm
mysql-community-test-5.7.12-1.el6.x86_64.rpm
mysql-community-common-5.7.12-1.el6.x86_64.rpm
mysql-community-devel-5.7.12-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.12-1.el6.x86_64.rpm
mysql-community-embedded-5.7.12-1.el6.x86_64.rpm
mysql-community-server-5.7.12-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.12-1.el6.x86_64.rpm
mysql-community-client-5.7.12-1.el6.x86_64.rpm
[root@localhost ~]# ll
total 1138324
-rw-r--r--. 1 root root  457492480 Mar 29 01:53 mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415  23672176 Mar 29 00:38 mysql-community-client-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415    334040 Mar 29 00:38 mysql-community-common-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   3765324 Mar 29 00:38 mysql-community-devel-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415  38736700 Mar 29 00:38 mysql-community-embedded-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 133956388 Mar 29 00:39 mysql-community-embedded-devel-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   2174152 Mar 29 00:39 mysql-community-libs-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415   1720844 Mar 29 00:39 mysql-community-libs-compat-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 149101172 Mar 29 00:40 mysql-community-server-5.7.12-1.el6.x86_64.rpm
-rw-r--r--. 1 7155 31415 104017276 Mar 29 00:41 mysql-community-test-5.7.12-1.el6.x86_64.rpm

3、mysql的rpm安装
安装mysql-community-server之前,必须安装mysql-community-client和mysql-community-common  rpm包。而安装community-client和community-common包之前,必须删除mysql-lib(系统自带的版本过低)

3.1、删除mysql-lib(系统自带的版本过低)
[root@localhost ~]# yum remove mysql-libs
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
No Match for argument: mysql-libs
Loading mirror speeds from cached hostfile
 * base: mirrors.skyshe.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.sina.cn
base                                                                                                                                                                                                                                                   | 3.7 kB     00:00    
extras                                                                                                                                                                                                                                                 | 3.4 kB     00:00    
updates                                                                                                                                                                                                                                                | 3.4 kB     00:00    
updates/primary_db                                                                                                                                                                                                                                     | 4.6 MB     00:11    
Package(s) mysql-libs available, but not installed.
No Packages marked for removal

3.2、依次安装如下软件包(common、libs、client、server
[root@localhost ~]# rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.12-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]
[root@localhost ~]# rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.12-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
[root@localhost ~]# rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.12-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
[root@localhost ~]# rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.12-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]

4、启动mysql 服务
[root@localhost ~]# service mysqld start
Initializing MySQL database:                               [  OK  ]
Installing validate password plugin:                       [  OK  ]
Starting mysqld:                                           [  OK  ]

查看端口:
[root@localhost ~]#  netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name  
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1857/sshd          
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1733/cupsd         
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2017/master        
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      2317/sshd          
tcp        0      0 :::22                       :::*                        LISTEN      1857/sshd          
tcp        0      0 ::1:631                     :::*                        LISTEN      1733/cupsd         
tcp        0      0 ::1:25                      :::*                        LISTEN      2017/master        
tcp        0      0 ::1:6010                    :::*                        LISTEN      2317/sshd          
tcp        0      0 :::3306                     :::*                        LISTEN      4058/mysqld        
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1739/dhclient      
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1733/cupsd   

5、初始密码修改及登录
5.1、rpm安装mysql后,会自动初始化一个密码,在日志中
    
[root@localhost ~]# cat /var/log/mysqld.log | more
2016-04-22T15:39:25.727167Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-22T15:39:27.605542Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-04-22T15:39:28.078249Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-04-22T15:39:28.235370Z 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: 661d21b3-08a0-11e6-850f-000c295e08dc.
2016-04-22T15:39:28.238925Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-04-22T15:39:28.240976Z 1 [Note] A temporary password is generated for root@localhost: lVxXU4pWRl;o
2016-04-22T15:39:33.163234Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-22T15:39:33.171396Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.12) starting as process 3802 ...
2016-04-22T15:39:33.205737Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-04-22T15:39:33.205805Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-04-22T15:39:33.205810Z 0 [Note] InnoDB: Uses event mutexes
2016-04-22T15:39:33.205852Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-04-22T15:39:33.205859Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-04-22T15:39:33.205863Z 0 [Note] InnoDB: Using Linux native AIO
2016-04-22T15:39:33.210158Z 0 [Note] InnoDB: Number of pools: 1
2016-04-22T15:39:33.211440Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-04-22T15:39:33.462011Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-04-22T15:39:33.687983Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-04-22T15:39:33.732332Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-04-22T15:39:33.771963Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-04-22T15:39:33.830605Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-04-22T15:39:33.830799Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-04-22T15:39:34.056868Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-04-22T15:39:34.057483Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-04-22T15:39:34.057492Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-04-22T15:39:34.082331Z 0 [Note] InnoDB: Waiting for purge to start
2016-04-22T15:39:34.133351Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2522067
2016-04-22T15:39:34.165970Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-04-22T15:39:34.168555Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-04-22T15:39:34.171746Z 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-04-22T15:39:34.171968Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-04-22T15:39:34.172491Z 0 [Note] IPv6 is available.
2016-04-22T15:39:34.172503Z 0 [Note]   - '::' resolves to '::';
2016-04-22T15:39:34.172516Z 0 [Note] Server socket created on IP: '::'.
2016-04-22T15:39:34.263573Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160422  8:39:34
2016-04-22T15:39:34.286562Z 0 [Note] Event Scheduler: Loaded 0 events
2016-04-22T15:39:34.286759Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.aWFFmC.sql' started.
2016-04-22T15:39:34.297018Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.aWFFmC.sql' ended.
2016-04-22T15:39:34.297155Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.12'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
2016-04-22T15:39:34.297648Z 0 [Note] Giving 0 client threads a chance to die gracefully
2016-04-22T15:39:34.297666Z 0 [Note] Shutting down slave threads
2016-04-22T15:39:34.297671Z 0 [Note] Forcefully disconnecting 0 remaining clients
2016-04-22T15:39:34.297677Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2016-04-22T15:39:34.297816Z 0 [Note] Binlog end
2016-04-22T15:39:34.298299Z 0 [Note] Shutting down plugin 'ngram'
2016-04-22T15:39:34.298309Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2016-04-22T15:39:34.298314Z 0 [Note] Shutting down plugin 'ARCHIVE'
2016-04-22T15:39:34.298317Z 0 [Note] Shutting down plugin 'partition'
2016-04-22T15:39:34.298319Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2016-04-22T15:39:34.298340Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2016-04-22T15:39:34.298344Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2016-04-22T15:39:34.298346Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2016-04-22T15:39:34.298348Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2016-04-22T15:39:34.298350Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2016-04-22T15:39:34.298353Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2016-04-22T15:39:34.298355Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2016-04-22T15:39:34.298357Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2016-04-22T15:39:34.298359Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2016-04-22T15:39:34.298362Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'

5.2、修改 mysql root密码
由于最新的mysql版本对密码策略有要求,所以必须增加复杂程度才能通过。
注意,用刚才的随机密码登陆mysql.
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.12

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password='Nsj820@126.com';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

5.3、设置允许root 从任何IP地址登陆
默认情况下,mysql只允许locathost本地登陆,用Navicat 是无法远程登陆的。
[root@localhost ~]# mysql -uroot -pNsj820@126.com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.12 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on *.* to 'root'@'%' identified by 'Nsj820@126.com';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> exit


注:Mysql的安装方式有多种,采用这种rpm安装的方式,不需要另外再进行其他设置,即可实现开机启动
0 0
原创粉丝点击