首页 > 数据库 >Linux安装mysql 02

Linux安装mysql 02

时间:2023-07-24 17:34:17浏览次数:50  
标签:02 39 x86 5.7 mysql 64 Linux el7

1:新建目录:

 

2:下载Mysql数据库文件:

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar:

3:安装数据库文件

解压文件

tar -xvf mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar

 

 yum -y install mysql-comm*.rpm

 按照过程中发现包冲突,由于是新装的系统,故卸载掉相关包,重新安装

rpm -qa | grep mariadb
rpm -e --nodeps mariadb-connector-c-3.1.11-2.oc8.1.x86_64
rpm -e --nodeps mariadb-connector-c-config-3.1.11-2.oc8.1.noarch

 再次执行安装

yum -y install mysql-comm*.rpm

 

安装成功

[root@VM-4-14-opencloudos mysql]# yum -y install mysql-comm*.rpm
Last metadata expiration check: 0:11:16 ago on Mon 24 Jul 2023 04:34:33 PM CST.
Dependencies resolved.
================================================================================================================================================================================
 Package                                                 Architecture                   Version                                      Repository                            Size
================================================================================================================================================================================
Installing:
 mysql-community-client                                  x86_64                         5.7.39-1.el7                                 @commandline                          28 M
 mysql-community-common                                  x86_64                         5.7.39-1.el7                                 @commandline                         311 k
 mysql-community-devel                                   x86_64                         5.7.39-1.el7                                 @commandline                         4.2 M
 mysql-community-embedded                                x86_64                         5.7.39-1.el7                                 @commandline                          46 M
 mysql-community-embedded-compat                         x86_64                         5.7.39-1.el7                                 @commandline                          22 M
 mysql-community-embedded-devel                          x86_64                         5.7.39-1.el7                                 @commandline                         127 M
 mysql-community-libs                                    x86_64                         5.7.39-1.el7                                 @commandline                         2.6 M
 mysql-community-libs-compat                             x86_64                         5.7.39-1.el7                                 @commandline                         1.2 M
 mysql-community-server                                  x86_64                         5.7.39-1.el7                                 @commandline                         178 M
 mysql-community-test                                    x86_64                         5.7.39-1.el7                                 @commandline                         121 M
Installing dependencies:
 compat-openssl10                                        x86_64                         1:1.0.2o-4.oc8                               AppStream                            1.1 M
 ncurses-compat-libs                                     x86_64                         6.1-9.20180224.oc8                           BaseOS                               327 k
 perl-JSON                                               noarch                         2.97.001-2.oc8                               AppStream                             95 k

Transaction Summary
================================================================================================================================================================================
Install  13 Packages

Total size: 532 M
Installed size: 2.7 G
Downloading Packages:
[SKIPPED] ncurses-compat-libs-6.1-9.20180224.oc8.x86_64.rpm: Already downloaded
[SKIPPED] compat-openssl10-1.0.2o-4.oc8.x86_64.rpm: Already downloaded
[SKIPPED] perl-JSON-2.97.001-2.oc8.noarch.rpm: Already downloaded
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                        1/1
  Installing       : mysql-community-common-5.7.39-1.el7.x86_64                                                                                                            1/13
  Installing       : mysql-community-libs-5.7.39-1.el7.x86_64                                                                                                              2/13
  Running scriptlet: mysql-community-libs-5.7.39-1.el7.x86_64                                                                                                              2/13
  Installing       : compat-openssl10-1:1.0.2o-4.oc8.x86_64                                                                                                                3/13
  Running scriptlet: compat-openssl10-1:1.0.2o-4.oc8.x86_64                                                                                                                3/13
  Installing       : mysql-community-devel-5.7.39-1.el7.x86_64                                                                                                             4/13
  Installing       : mysql-community-embedded-5.7.39-1.el7.x86_64                                                                                                          5/13
  Running scriptlet: mysql-community-embedded-5.7.39-1.el7.x86_64                                                                                                          5/13
  Installing       : perl-JSON-2.97.001-2.oc8.noarch                                                                                                                       6/13
  Installing       : ncurses-compat-libs-6.1-9.20180224.oc8.x86_64                                                                                                         7/13
  Installing       : mysql-community-client-5.7.39-1.el7.x86_64                                                                                                            8/13
  Running scriptlet: mysql-community-server-5.7.39-1.el7.x86_64                                                                                                            9/13
  Installing       : mysql-community-server-5.7.39-1.el7.x86_64                                                                                                            9/13
  Running scriptlet: mysql-community-server-5.7.39-1.el7.x86_64                                                                                                            9/13
  Installing       : mysql-community-test-5.7.39-1.el7.x86_64                                                                                                             10/13
  Installing       : mysql-community-embedded-devel-5.7.39-1.el7.x86_64                                                                                                   11/13
  Installing       : mysql-community-embedded-compat-5.7.39-1.el7.x86_64                                                                                                  12/13
  Installing       : mysql-community-libs-compat-5.7.39-1.el7.x86_64                                                                                                      13/13
  Running scriptlet: mysql-community-libs-compat-5.7.39-1.el7.x86_64                                                                                                      13/13
[/usr/lib/tmpfiles.d/mysql.conf:23] Line references path below legacy directory /var/run/, updating /var/run/mysqld → /run/mysqld; please update the tmpfiles.d/ drop-in file accordingly.

  Verifying        : ncurses-compat-libs-6.1-9.20180224.oc8.x86_64                                                                                                         1/13
  Verifying        : compat-openssl10-1:1.0.2o-4.oc8.x86_64                                                                                                                2/13
  Verifying        : perl-JSON-2.97.001-2.oc8.noarch                                                                                                                       3/13
  Verifying        : mysql-community-client-5.7.39-1.el7.x86_64                                                                                                            4/13
  Verifying        : mysql-community-common-5.7.39-1.el7.x86_64                                                                                                            5/13
  Verifying        : mysql-community-devel-5.7.39-1.el7.x86_64                                                                                                             6/13
  Verifying        : mysql-community-embedded-5.7.39-1.el7.x86_64                                                                                                          7/13
  Verifying        : mysql-community-embedded-compat-5.7.39-1.el7.x86_64                                                                                                   8/13
  Verifying        : mysql-community-embedded-devel-5.7.39-1.el7.x86_64                                                                                                    9/13
  Verifying        : mysql-community-libs-5.7.39-1.el7.x86_64                                                                                                             10/13
  Verifying        : mysql-community-libs-compat-5.7.39-1.el7.x86_64                                                                                                      11/13
  Verifying        : mysql-community-server-5.7.39-1.el7.x86_64                                                                                                           12/13
  Verifying        : mysql-community-test-5.7.39-1.el7.x86_64                                                                                                             13/13

Installed:
  compat-openssl10-1:1.0.2o-4.oc8.x86_64                      mysql-community-client-5.7.39-1.el7.x86_64            mysql-community-common-5.7.39-1.el7.x86_64
  mysql-community-devel-5.7.39-1.el7.x86_64                   mysql-community-embedded-5.7.39-1.el7.x86_64          mysql-community-embedded-compat-5.7.39-1.el7.x86_64
  mysql-community-embedded-devel-5.7.39-1.el7.x86_64          mysql-community-libs-5.7.39-1.el7.x86_64              mysql-community-libs-compat-5.7.39-1.el7.x86_64
  mysql-community-server-5.7.39-1.el7.x86_64                  mysql-community-test-5.7.39-1.el7.x86_64              ncurses-compat-libs-6.1-9.20180224.oc8.x86_64
  perl-JSON-2.97.001-2.oc8.noarch

Complete!
[root@VM-4-14-opencloudos mysql]#

 执行mysql重启

systemctl restart mysqld.service 
systemctl start mysqld.service 
systemctl stop mysqld.service

 

查询启动过程的随机密码

cat /var/log/mysqld.log | grep 'temporary password is generated'

 

重置密码:

登录Mysql 

mysql -uroot -p 

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456@abcAbc';

 

由于上述密码策略不能设置简单的密码,故设置复杂的,开发及测试环境想要容易记得点,故设置简单的密码

修改密码后,查询密码策略等级

show variables like 'validate%';

 

 

SET GLOBAL validate_password_policy=LOW

set global validate_password_length = 6

 

设置远程登录MySQL

允许root用户在任何地方进行远程登录,并具有所有库任何操作权限;

GRANT ALL PRIVILEGES ON *.* TO '你的账户'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
flush privileges;

  

如果无法本地登录,可以查看防火墙或者ACL访问控制是否限制了端口

Linux防火墙

firewall-cmd --state
systemctl stop firewalld.service
systemctl start firewalld.service
systemctl disable firewalld.service
systemctl enable firewalld.service

云服务器ACL配置:

 测试联通并访问成功:

 

标签:02,39,x86,5.7,mysql,64,Linux,el7
From: https://www.cnblogs.com/lewisat/p/17577734.html

相关文章

  • Mysql高级1-存储引擎
    一、Mysql体系结构 1.1、连接层最上层是一个客户端和链接服务,主要完成一些类似于链接处理,授权认证,及相关的安全方案,服务器也会为安全接入的而每个客户端验证它所具有的操作权限1.2、服务层第二层架构主要完成大多数的核心服务功能,如SQL接口,并完......
  • Linux CentOS 7 安装 PostgreSQL v14
    1、安装PostgreSQL的RPM资源库sudoyuminstall-yhttps://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm2、安装PostgreSQLServersudoyuminstall-ypostgresql14-server3、初始化PostgreSQLsudo/usr/pgsql-14......
  • 【2023-07-23】周末计划
    23:00何以销烦暑,端居一院中。眼前无长物,窗下有清风。热散由心静,凉生为室空。此时身自得,难更与人同。                                                 ——白居易·《销......
  • Summer Training 2023 Mini Comp 1 (Experts)
    SummerTraining2023MiniComp1(Experts)2338Carnival-PCOIOnlineJudge(pcoij8.ddns.net)题目大意交互题,n个人穿着衣服,共有c种颜色,每一次可以询问一些人穿的衣服有多少种不同的颜色,最多可以询问3500次,请确定每个人穿的衣服是什么颜色做法第一眼可以看出来答案的上......
  • 安装Linux系统时,需要哪些分区?
    Linux安装的时候,分区有两种方式:可以选择自动配置分区,也可以手动配置分区,但很多人对这个分区不太了解,那么安装Linux系统时,需要哪些分区?这里简单为大家介绍一下。在Linux安装过程中,常见的分区包括以下几个:1、根分区(/)这是Linux系统的根目录,包括操作系统的核心文件......
  • 【2023.07.23】本命年生日纪念
    缘起这次本命年生日和以往不一样,比较特别,和女生单独去约会了(说好的下半年好好读书,不约会了呢?怎么认识的呢?说来也是碰巧,就是月初我决定好好提升自己,不要再被感情困扰的时候刚搬到新宿舍,手边没电脑打个乱斗,于是我时隔好久又重新下载了王者上号就被小黑拉进了一个匹配房间,刚好遇......
  • Qt mingw73_32 + MySql8.0 使用和对数据库操作 - 初窥篇1
    1、开发环境QtCreator4.8.2+Qt5.12.2+MySql8.0.332、设计背景现在已经有MySql8.0.33是64位的数据库,仅支持64位的程序,但是当前Qt程序编译环境是mingw73_3232位程序连接64位的数据库实例3、操作流程1)测试驱动代码+测试结果intmain(inta......
  • linux 的man 命令查看手册
    1、当使用man命令查看命令手册页的时候,这些手册页是由分页程序(pager)来显示的。分页程序是一种实用工具,能够逐页显示文本。可以通过点击空格键进行翻页,或是使用回车键逐行查看。另外还可以使用箭头键向前向后滚动手册页的内容(假设你用的终端仿真软件包支持箭头键功能)。读完了手册......
  • linux sh 脚本:备份文件及删除十天以前的备份文件
     #如果文件夹不存在,创建文件夹if[!-d"/www/backup/data"];thenmkdir/www/backup/ant-datafi#切换目录cd/usr/#开始打包备份tar-zcvf/www/backup/data/data-$(date+%Y%m%d).tar.gzdata#移除十天以前的备份文件包find/www/backup/data/-mtime+10-n......
  • Linux shell中的那些小把戏
    我日常使用Linuxshell(Bash),但是我经常忘记一些有用的命令或者shell技巧。是的,我能记住一些命令,但是肯定不会只在特定的任务上使用一次,所以我就开始在我的Dropbox账号里用文本文件写下这些Linuxshell的小技巧,现在我决定共享它给你。这个表我以后还会更新。记住,这里的一些贴士需......