Mysql之rpm方式安装
一、环境说明操作系统版本:centos7.6mysql版本:5.7.26[root@test1 ~]# cat /etc/redhat-releaseCentOS Linux release 7.6.1810 (Core)二、安装步骤1、下载mysql对应版本的rpm包从官网下载所需的安装包https://downloads.mysql.com/archives/community/2、卸载系统默
一、环境说明
操作系统版本:centos7.6
mysql版本:5.7.26
[root@test1 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
二、安装步骤
1、下载mysql对应版本的rpm包
从官网下载所需的安装包https://downloads.mysql.com/archives/community/
2、卸载系统默认安装的maridb
[root@test1 mysql5.7.26]# rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
3、MD5校验下载的软件包
[root@test1 opt]# md5sum mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
8a3f19f17a58900c45624ee26b0c2bb7 mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
4、解压下载的软件包
[root@test1 opt]# tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-devel-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-5.7.26-1.el7.x86_64.rpm
mysql-community-embedded-5.7.26-1.el7.x86_64.rpm
mysql-community-test-5.7.26-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.26-1.el7.x86_64.rpm
mysql-community-common-5.7.26-1.el7.x86_64.rpm
mysql-community-devel-5.7.26-1.el7.x86_64.rpm
mysql-community-client-5.7.26-1.el7.x86_64.rpm
mysql-community-server-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
5、执行rpm安装
[root@test1 opt]# rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-common-5.7.26-1.e################################# [100%]
[root@test1 opt]# rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-libs-5.7.26-1.el7################################# [100%]
[root@test1 opt]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-client-5.7.26-1.e################################# [100%]
[root@test1 opt]# rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-server-5.7.26-1.e################################# [100%]
6、启动mysqld服务
[root@test1 opt]# systemctl start mysqld
[root@test1 opt]# systemctl enable mysqld
7、修改初始密码
获取初始密码
[root@test1 ~]# cat /var/log/mysqld.log |grep root@localhost
2021-01-28T05:56:31.873632Z 1 [Note] A temporary password is generated for root@localhost: F=!Aq*:Lk5h?
使用初始密码登录数据库
[root@test1 ~]# 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.26
Copyright © 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>
修改root@localhost账户密码
8、创建一个普通账户
9、使用客户端连接mysqld测试验证
三、rpm方式重要文件路径说明
主要文件默认路径如下:
配置文件路径:/etc/my.cnf
数据存储目录:/var/lib/mysql
错误日志存储路径:/var/log/mysqld.log
socket文件路径:/var/lib/mysql/mysql.sock
如上参数均可以通过/etc/my.cnf参数配置文件查看和自定义。
四、FAQ
1、报错缺少libsasl2.so.2()依赖包
解决方案:
下载与操作系统一直的依赖包。
更多推荐
所有评论(0)