运维笔记之centos7安装mysql数据库

这篇具有很好参考价值的文章主要介绍了运维笔记之centos7安装mysql数据库。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

安装wget

[root@stem-mysql ~]# yum install wget -y


...
总下载量:547 k
安装大小:2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm                                                                                                                                  | 547 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : wget-1.14-18.el7_6.1.x86_64                                                                                                                                         1/1 
  验证中      : wget-1.14-18.el7_6.1.x86_64                                                                                                                                         1/1 

已安装:
  wget.x86_64 0:1.14-18.el7_6.1 

下载官方rpm包

[root@stem-mysql ~]# cd /tmp/
[root@stem-mysql tmp]# wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

...
2023-12-14 07:52:47 (231 MB/s) - 已保存 “mysql57-community-release-el7-8.noarch.rpm” [9116/9116])

安装依赖包

[root@stem-mysql tmp]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm 
警告:mysql57-community-release-el7-8.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql57-community-release-el7-8  ################################# [100%]

导入官方公钥

如果使用的4.1以上版本的rpm的话,除了import mysql的公钥到个人用户的配置中,还需要import mysql的公钥到RPM的配置中文章来源地址https://www.toymoban.com/news/detail-765761.html

[root@stem-mysql tmp]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

安装数据库服务

[root@stem-mysql tmp]# yum -y install mysql-community-server

...
已安装:
  mysql-community-libs.x86_64 0:5.7.44-1.el7                mysql-community-libs-compat.x86_64 0:5.7.44-1.el7                mysql-community-server.x86_64 0:5.7.44-1.el7               

作为依赖被安装:
  mysql-community-client.x86_64 0:5.7.44-1.el7    mysql-community-common.x86_64 0:5.7.44-1.el7    net-tools.x86_64 0:2.0-0.25.20131004git.el7    perl.x86_64 4:5.16.3-299.el7_9        
  perl-Carp.noarch 0:1.26-244.el7                 perl-Encode.x86_64 0:2.51-7.el7                 perl-Exporter.noarch 0:5.68-3.el7              perl-File-Path.noarch 0:2.09-2.el7    
  perl-File-Temp.noarch 0:0.23.01-3.el7           perl-Filter.x86_64 0:1.49-3.el7                 perl-Getopt-Long.noarch 0:2.40-3.el7           perl-HTTP-Tiny.noarch 0:0.033-3.el7   
  perl-PathTools.x86_64 0:3.40-5.el7              perl-Pod-Escapes.noarch 1:1.04-299.el7_9        perl-Pod-Perldoc.noarch 0:3.20-4.el7           perl-Pod-Simple.noarch 1:3.28-4.el7   
  perl-Pod-Usage.noarch 0:1.63-3.el7              perl-Scalar-List-Utils.x86_64 0:1.27-248.el7    perl-Socket.x86_64 0:2.010-5.el7               perl-Storable.x86_64 0:2.45-3.el7     
  perl-Text-ParseWords.noarch 0:3.29-4.el7        perl-Time-HiRes.x86_64 4:1.9725-3.el7           perl-Time-Local.noarch 0:1.2300-2.el7          perl-constant.noarch 0:1.27-2.el7     
  perl-libs.x86_64 4:5.16.3-299.el7_9             perl-macros.x86_64 4:5.16.3-299.el7_9           perl-parent.noarch 1:0.225-244.el7             perl-podlators.noarch 0:2.5.1-3.el7   
  perl-threads.x86_64 0:1.87-4.el7                perl-threads-shared.x86_64 0:1.43-6.el7        

替代:
  mariadb-libs.x86_64 1:5.5.68-1.el7 

启动mysql

[root@stem-mysql tmp]# systemctl start mysqld

修改数据库管理员密码

[root@stem-mysql tmp]# grep 'temporary password' /var/log/mysqld.log
2023-12-14T00:01:07.587041Z 1 [Note] A temporary password is generated for root@localhost: *********

[root@stem-mysql tmp]#  mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.44

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> ALTER USER 'root'@'localhost' IDENTIFIED BY '**********'; 
Query OK, 0 rows affected (0.00 sec)

允许远程访问

[root@stem-mysql tmp]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.44 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select Host,User from user;
+-----------+---------------+
| Host      | User          |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
3 rows in set (0.00 sec)

mysql> update user set Host='%' where User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

设置防火墙

[root@stem-mysql tmp]# firewall-cmd --state
running
[root@stem-mysql tmp]# firewall-cmd --zone=public --list-ports

[root@stem-mysql tmp]# firewall-cmd --zone=public --add-port=3306/tcp --permanen
success
[root@stem-mysql tmp]# setenforce 0
[root@stem-mysql tmp]# firewall-cmd --reload
success

到了这里,关于运维笔记之centos7安装mysql数据库的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 图数据库_Neo4j中文版_Centos7.9安装Neo4j社区版3.5.9_基于jdk1.8---Neo4j图数据库工作笔记0012

        由于我们在国内使用啊,具体还是要用中文版滴,找了好久这个neo4j,原来还是有中文版的, 中文版下载地址在这里: 所有版本都在这里了,需要哪个自己去下载就可以了,要注意下载以后,参考:  在这个位置下载,主要是找到对应中文版的安装包,花了写时间啊 然后我们看一下安装

    2024年02月12日
    浏览(40)
  • Ladp数据库安装和配置自定义schema ,Centos7环境

    最近安装ldap看了不少教程,整理下用到的有用的资料,并把自己的搭建过程分享。 ldap介绍:openLDAP入门与安装 官方文档:https://www.openldap.org/doc/admin22/schema.html 安装配置:Centos7 搭建openldap完整详细教程(真实可用) bug解决:ldap运维中遇到的问题 schema自定义:导入schema到openL

    2024年02月12日
    浏览(48)
  • 磐维数据库panweidb单节点服务器在centos7.9安装(研发环境)

    使用omm用户登录到openGauss包安装的主机,解压openGauss压缩包到安装目录(假定安装目录为/opt/panweidb/soft,请用实际值替换)。 假定解压包的路径为/opt/panweidb/soft,进入解压后目录下的simpleInstall。 执行install.sh脚本安装openGauss。 上述命令中,-w是指初始化数据库密码(gs_initdb指

    2024年02月06日
    浏览(42)
  • 初识mysql数据库之mysql数据库安装(centos)

    目录 一、卸载不需要的环境 二、安装mysql yum源 三、安装mysql 四、登录mysql 1. 直接登录 2. 设置免密码登录 五、配置my.cnf 六、mysql登录时的一些选项介绍 要注意,在安装mysql数据库时,最好将用户切换为root,避免一些不必要的问题。当数据库安装好后,普通用户也可以使用的

    2024年02月03日
    浏览(45)
  • 数据库应用:CentOS 7离线安装MySQL与Nginx

    目录 一、理论 1.安装依赖 二、实验 1.离线安装MySQL与Nginx 2.离线安装Nginx 三、问题 1.执行nginx -v命令报错 四、总结 (1)概念 安装依赖是指在软件开发中,为了运行或者编译一个程序或者库,在计算机上安装与其相依赖并且需要使用的其它程序或者库。根据查询相关公开信息

    2024年02月16日
    浏览(56)
  • Influxdb数据库(centos7)

    简介 InfluxDB是一个由InfluxData开发的开源时序型数据库,专注于海量时序数据的高性能读、高性能写、高效存储与实时分析等,在DB-Engines Ranking时序型数据库排行榜上排名第一: InfluxDB广泛应用于DevOps监控、IoT监控、实时分析等场景。除了具有成本优势的高性能读、高性能写、

    2024年02月12日
    浏览(42)
  • CentOS7自动备份数据库到git

    虽然数据库没什么数据,但是有就是珍贵的啦,为了服务器什么的无了,所以还是要自动备份一下比较好。 Open备忘第一页 步骤 在Gitee(github)上创建一个 私有 仓库 Gitee(github)配置好服务器的ssh 在服务器一个好位置克隆仓库下来刚刚创建的私有仓库 在服务器写脚本 : 为

    2024年01月25日
    浏览(39)
  • [Linux][CentOs][Mysql]基于Linux-CentOs7.9系统安装并配置开机自启Mysql-8.0.28数据库

    目录 一、准备工作:获取安装包和相应工具 (一)所需安装包 (二)安装包下载链接 (三)在服务器上创建文件夹并上传安装包 二、安装MySql (一)删除系统自带的mariadb (二)安装MySQL依赖包libaio (三)创建MySQL组和用户并设置密码 (四)将MySQL目录的权限授给MySQL用户

    2024年03月25日
    浏览(51)
  • MySQL数据库 --- 运维篇

    错误日志是 MySQL 中最重要的日志之一,它记录了当 mysqld 启动和停止时,以及服务器在运行过程中发生任何严重错误时的相关信息。当数据库出现任何故障导致无法正常使用时,建议首先查看此日志。 该日志是默认开启的,默认存放目录 /var/log/,默认的日志文件名为 mysqld

    2024年02月08日
    浏览(99)
  • 【运维知识进阶篇】Zabbix5.0稳定版详解11(在Grafana中使用Zabbix插件:安装Grafana+安装Zabbix插件+添加数据源+Grafana直连MySQL数据库取值)

    本篇文章给大家介绍在Grafana中使用Zabbix插件,Zabbix扩展的很多,该讲的基本上全讲了,这篇文章结束后,就考虑换个内容了。 Grafana是用于可视化大型测量数据的开源程序,类似于Kibana,我们在里面使用zabbix插件,可以实现对其他主机的监控,监控数据能够更好的显示出来。

    2024年01月15日
    浏览(48)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包