由于分布式系统架构中含有mysql中间件,用以元数据的存储。搞了一个社区版的mysql,版本号5.7.13,GA版本(整体可用)。
网络好的时候 dev.mysql.com 访问很流畅,下载 文件mysql-community-server-5.7.13-1.el7.x86_64.rpm ,但是安装过程需要多个rpm包,反复多次,最后乖乖的下载 mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar (500M)
http://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar
1、安装 mysql-community-common-5.7.9-1.el7.x86_64.rpm 的时候提示,有文件冲突,如:
warning: mysql-community-common-5.7.9-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing… ################################# [100%] file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.9-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
2、出现以上信息说明有其他版本的mysql类库存在,需要删除后再安装
检查安装包:
[root@DEV-RHEL71-012 mysql]# rpm -qa | grep ‘mariadb-libs’
mariadb-libs-5.5.41-2.el7_0.x86_64
卸载旧版本:
[root@DEV-RHEL71-012 mysql]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64 –nodeps
3、安装 mysql-community-server-5.7.9-1.el7.x86_64.rpm
安装过程如下:
[root@DEV-RHEL71-012 mysql]# rpm -ivh mysql-community-common-5.7.9-1.el7.x86_64.rpm warning: mysql-community-common-5.7.9-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing… ################################# [100%] Updating / installing… 1:mysql-community-common-5.7.9-1.el################################# [100%] [root@DEV-RHEL71-012 mysql]# rpm -ivh mysql-community-libs- mysql-community-libs-5.7.9-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.9-1.el7.x86_64.rpm [root@DEV-RHEL71-012 mysql]# rpm -ivh mysql-community-libs-5.7.9-1.el7.x86_64.rpm warning: mysql-community-libs-5.7.9-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing… ################################# [100%] Updating / installing… 1:mysql-community-libs-5.7.9-1.el7 ################################# [100%] [root@DEV-RHEL71-012 mysql]# rpm -ivh mysql-community-client-5.7.9-1.el7.x86_64.rpm warning: mysql-community-client-5.7.9-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing… ################################# [100%] Updating / installing… 1:mysql-community-client-5.7.9-1.el################################# [100%] [root@DEV-RHEL71-012 mysql]# rpm -ivh mysql-community-server-5.7.9-1.el7.x86_64.rpm warning: mysql-community-server-5.7.9-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing… ################################# [100%] Updating / installing… 1:mysql-community-server-5.7.9-1.el################################# [100%]
4、初始化mysql :
[root@DEV-RHEL71-012 mysql]# mysqld –initialize
5、获取初始化密码:
[root@DEV-RHEL71-012 mysql]# more /var/log/mysqld.log
2016-07-21T06:08:10.180268Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server op
tion (see documentation for more details).
2016-07-21T06:08:11.836294Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-07-21T06:08:12.113570Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-07-21T06:08:12.190776Z 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: 812d4953-4f09-11e6-87e4-005056b00910.
2016-07-21T06:08:12.195975Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2016-07-21T06:08:12.197226Z 1 [Note] A temporary password is generated for root@localhost: b=/wpqyRK3hu
[root@DEV-RHEL71-012 mysql]# chown mysql:mysql /var/lib/mysql -R
[root@DEV-RHEL71-012 mysql]# su - mysql
[root@DEV-RHEL71-012 mysql]# systemctl start mysqld.service
[root@DEV-RHEL71-012 mysql]# cd
[root@DEV-RHEL71-012 ~]# more .
./ .bash_history .bash_profile .cache/ .cshrc .tcshrc
../ .bash_logout .bashrc .config/ .ssh/ .viminfo
[root@DEV-RHEL71-012 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.9
Copyright (c) 2000, 2015, 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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user ‘root’@’localhost’ identified by ‘passwd’;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
+——————–+
4 rows in set (0.00 sec)
mysql>
参考连接:
修改mysql密码:
http://www.th7.cn/system/lin/201604/161700.shtml