TEL:
CentOS6.6+MySQL5.7的RPM部署
| 发布时间: 2020-12-14 20:44:31 | 1435 次浏览

1.下载安装MySQL的Yum源的rpm

[root@10-9-15-140 ~]# wget http://repo.mysql.com/mysql57-community-release-el6.rpm
[root@10-9-15-140 ~]# rpm -ivh mysql57-community-release-el6.rpm

2.查看repo文件

[root@10-9-15-140 ~]# ll /etc/yum.repos.d/
total 32
-rw-r--r-- 1 root root   89 Jun  8 19:58 10gen.repo
-rw-r--r-- 1 root root 1453 Jun  8 19:58 CentOS-Base.repo
-rw-r--r-- 1 root root  677 Jun  8 19:58 epel.repo
-rw-r--r-- 1 root root  111 Jun  8 19:58 kernel6.repo
-rw-r--r-- 1 root root 1836 Apr 27  2017 mysql-community.repo
-rw-r--r-- 1 root root 1885 Apr 27  2017 mysql-community-source.repo
-rw-r--r-- 1 root root  180 Jun  8 19:58 remi.repo
-rw-r--r-- 1 root root  671 Jun  8 19:58 rpmforge.repo

3.安装MySQL

[root@10-9-15-140 ~]# yum install -y mysql-server
[root@10-9-15-140 ~]# rpm -qa|grep mysql
mysql57-community-release-el6-11.noarch
mysql-community-client-5.7.26-1.el6.x86_64
mysql-community-libs-5.7.26-1.el6.x86_64
mysql-community-server-5.7.26-1.el6.x86_64
mysql-community-common-5.7.26-1.el6.x86_64

自动也将client包安装了,比较省事。

4.启动

[root@10-9-15-140 ~]# service mysqld start
Initializing MySQL database:                               [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@10-9-15-140 ~]# service mysqld status
mysqld (pid  12195) is running...

CentOS6.x的service mysqld start|stop|status|restart
就等价于
CentOS7.X的systemctl start|stop|status|restart mysqld
其实service ⼀次只能操作⼀个组件,
但是systemctl⼀次可以操作很多组件,
⽐如 systemctl start mysql httpd12

5.登录

查找系统默认密码(5.6版本是空密码,但是5.7系统会给⼀个初始复杂密码)
[root@10-9-15-140 ~]# cat /var/log/mysqld.log |grep password
2019-06-24T13:31:13.500735Z 1 [Note] A temporary password is generated for root@                localhost: YyvV9<olgejS
[root@10-9-15-140 ~]# mysql -uroot -p'YyvV9<olgejS'
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 4
Server version: 5.7.26

Copyright (c) 2000, 2019, 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>