微服务架构项目搭建过程中的Mysql安装和相关问题

搭建微服务架构的过程中需要使用Mysql数据库,Mysql数据库搭建着实不是一个容易的事情,会碰到各种各样的问题,如果没有一个安装数据库的思路真的很难把数据库安装好,并且掉入到安装的坑当中而无法自拔,因为数据库版本与微服务架构中初始化数据的数据库版本不匹配导致反复安装折腾了一个周,所以把安装思路和遇到的问题跟大家分享一下

数据库安装时一定要确认的问题就是 数据库安装的版本,在工作中一般这一块都会去确认,安装文档应该也会有说明,如果没有说明,记得一定要去确认一下,因为涉及到安装完成后的数据库初始化操作,一般数据库初始脚本与数据库都会进行匹配,本文以下载Mysql5.7为例

数据库安装前为了避免出现各种奇葩的问题,先进行依赖的安装最好都安装完成

yum install libaio libaio-devel numactl-libs wget vim -y

yum这里简单说一下yum。在Linux的学习或者使用过程中应该对yum都有一定的了解

yum是软件仓库,repo文件是Linux中yum的配置文件,定义了软件仓库的细节例如从哪里下载软件包等内容

Exp:在进行安装Mysql报错Cannot find a valid baseurl for repo:base就是由于repo源不对导致

# 下载安装包function1:使用wget命令从官网下载
wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tartar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar

function2:从官网下载上传至服务器

rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm​rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm​rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm​rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
systemctl start mysqld.service

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

step1: mysql> alter user 'root'@'localhost' identified by '123456';

ERROR 1203 (42000): User dba already has more than ‘max_user_connections’ active connections。

1.vim /etc/my.cnf//在[mysqld]下添加max_connections=10000​2.重启mysql服务[root@localhost ]:systemctl restart mysqld.service​3.查询最大连接数mysql> show variables like "max_connections";

输入正确的用户名和密码登录报错:ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

1.停止mysql数据库systemctl restart mysqld.service(或直接 kill -9 [PID]  杀进程!)2.执行如下命令mysqld_safe --user=mysql --skip-grant-tables --skip-networking &3.使用root登录mysql数据库mysql -u root mysql4.更新root密码mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';5.刷新权限mysql> FLUSH PRIVILEGES;6.退出mysqlmysql> quit​7.重启mysql[root@localhost ]:systemctl restart mysqld.service​8.使用root用户重新登录mysqlmysql -uroot -p Enter password:

报错:null, message from server: “Host ‘117.89.209.18’ is not allowed to connect to this MySQL server”这是因为你的帐号不允许从远程登陆,只能在服务器所在的机器才可以。这个时候只要在localhost的那台电脑改为%,任何机器都可以访问都可以即可

mysql>use mysql;mysql>update user set host = '%' where user = 'root';

这种情况不多见,一般是操作过多没记住,但是在navicat有保存就可以找到

1.导出连接a.选择想要获取密码的数据库即可b.拿到保存到本地的connections.ncx文件中的Password2.解密passworda.登陆https://tool.lu/coderunner,使用PHP在线运行工具

粘贴如下代码

class NavicatPassword
{
protected $version = 0;
protected $aesKey = 'libcckeylibcckey';
protected $aesIv = 'libcciv libcciv ';
protected $blowString = '3DC5CA39';
protected $blowKey = null;
protected $blowIv = null;

public function __construct($version = 12)
{
$this->version = $version;
$this->blowKey = sha1('3DC5CA39', true);
$this->blowIv = hex2bin('d9c7c3c8870d64bd');
}

public function encrypt($string)
{
$result = FALSE;
switch ($this->version) {
case 11:
$result = $this->encryptEleven($string);
break;
case 12:
$result = $this->encryptTwelve($string);
break;
default:
break;
}

return $result;
}

protected function encryptEleven($string)
{
$round = intval(floor(strlen($string) / 8));
$leftLength = strlen($string) % 8;
$result = '';
$currentVector = $this->blowIv;

for ($i = 0; $i < $round; $i++) {
$temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector));
$currentVector = $this->xorBytes($currentVector, $temp);
$result .= $temp;
}

if ($leftLength) {
$currentVector = $this->encryptBlock($currentVector);
$result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
}

return strtoupper(bin2hex($result));
}

protected function encryptBlock($block)
{
return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);
}

protected function decryptBlock($block)
{
return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);
}

protected function xorBytes($str1, $str2)
{
$result = '';
for ($i = 0; $i < strlen($str1); $i++) {
$result .= chr(ord($str1[$i]) ^ ord($str2[$i]));
}

return $result;
}

protected function encryptTwelve($string)
{
$result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
return strtoupper(bin2hex($result));
}

public function decrypt($string)
{
$result = FALSE;
switch ($this->version) {
case 11:
$result = $this->decryptEleven($string);
break;
case 12:
$result = $this->decryptTwelve($string);
break;
default:
break;
}

return $result;
}

protected function decryptEleven($upperString)
{
$string = hex2bin(strtolower($upperString));

$round = intval(floor(strlen($string) / 8));
$leftLength = strlen($string) % 8;
$result = '';
$currentVector = $this->blowIv;

for ($i = 0; $i < $round; $i++) {
$encryptedBlock = substr($string, 8 * $i, 8);
$temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector);
$currentVector = $this->xorBytes($currentVector, $encryptedBlock);
$result .= $temp;
}

if ($leftLength) {
$currentVector = $this->encryptBlock($currentVector);
$result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
}

return $result;
}

protected function decryptTwelve($upperString)
{
$string = hex2bin(strtolower($upperString));
return openssl_decrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
}
};
//需要指定版本两种,11或12
//$navicatPassword = new NavicatPassword(11);
$navicatPassword = new NavicatPassword(11);

//解密
//$decode = $navicatPassword->decrypt('15057D7BA390');
$decode = $navicatPassword->decrypt('15057D7BA390');
echo $decode."\n";
?>
用文件中的文件中的password,替换上面代码中的$decode = $navicatPassword->decrypt('E75BF077AB8BAA3AC2D5');点击运行之后,就会得到真实密码

Original: https://www.cnblogs.com/Skywal/p/15880237.html
Author: 天行者_sky
Title: 微服务架构项目搭建过程中的Mysql安装和相关问题

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/613001/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • mycat数据库集群系列之mycat读写分离安装配置

    最近在梳理数据库集群的相关操作,现在花点时间整理一下关于mysql数据库集群的操作总结,恰好你又在看这一块,供一份参考。本次系列终结大概包括以下内容:多数据库安装、mycat部署安…

    Linux 2023年6月14日
    0135
  • Java50个关键字之final

    1)final用于声明属性、方法和类,分别表示属性不可变、方法不可覆盖、类不可被继承(不能再派生出新的子类)。 final属性:被final修饰的变量不可变,由于不可变有两重含义,…

    Linux 2023年6月7日
    099
  • Redis多线程原理详解

    从上图中可以看出只有以下3个地方用的是多线程,其他地方都是单线程: 1:接收请求参数 2:解析请求参数 3:请求响应,即将结果返回给client 很明显以上3点各个请求都是互相独立…

    Linux 2023年5月28日
    091
  • haproxy

    haproxy 一.haproxy简介 二.负载均衡 三.haproxy安装 1.yum安装 2.源码安装 2.1 配置文件解析 2.2时间格式 2.3 全局global 2.4 …

    Linux 2023年6月7日
    0115
  • LeetCode-125. 验证回文串

    题目来源 题目详情 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明: 本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: &#8…

    Linux 2023年6月7日
    089
  • Linux之export命令

    镜像下载、域名解析、时间同步请点击阿里云开源镜像站 export命令用于将shell变量输出为环境变量,或者将shell函数输出为环境变量。 一个变量创建时,它不会自动地为在它之后…

    Linux 2023年5月27日
    0129
  • MarkDown_语法规则

    MarkDown_语法规则 版权 作者: 罗在金 创建于:2021/11/22 修改于:2021/11/22 [基础篇] [标题] 这里我将源码嵌入代码框内,这样不会影响大纲的结构…

    Linux 2023年6月7日
    0114
  • Django Model 如何返回空的 QuerySet

    >>> from django.contrib.auth.models import User >>> User.objects.none() …

    Linux 2023年6月7日
    095
  • nodejs调用shell

    shelljs https://github.com/shelljs/shelljs 实例 var shell = require(‘shelljs’); if (!shell.w…

    Linux 2023年5月28日
    0113
  • Linux基线加固

    bash;gutter:true; 1、修改vsftp回显信息 (1)检查办法 修改vsftp回显信息: 需在安装VSFTP的情况下检查,未安装可忽略或禁用该项。 查看ftpd_b…

    Linux 2023年6月13日
    090
  • php连接mysql数据库大批量执行sql语句出现“Mysql server has gong away”错误

    php代码中加入以下代码 set_time_limit(3600); ini_set(‘memory_limit’, ‘1024M’); mysql客户端执行以下命令 set gl…

    Linux 2023年6月13日
    097
  • 搭建openvpn连接公司内网

    404. 抱歉,您访问的资源不存在。 可能是网址有误,或者对应的内容被删除,或者处于私有状态。 代码改变世界,联系邮箱 contact@cnblogs.com 园子的商业化努力-困…

    Linux 2023年6月7日
    0125
  • PYTORCH: 60分钟 | 训练一个分类器

    你已经知道怎样定义神经网络,计算损失和更新网络权重。现在你可能会想, 那么,数据呢? 通常,当你需要解决有关图像、文本或音频数据的问题,你可以使用python标准库加载数据并转换为…

    Linux 2023年6月16日
    0197
  • springboot 工程出现 socket hang up

    出现socket hang up 原因为程序处理时间长,超出了默认请求超时时间,导致socket断开 可以通过设置请求超时时间降低出现的概率以下示例中设置请求超时时间为三分钟 sp…

    Linux 2023年6月8日
    0116
  • [非原创]2048游戏自动化算法

    function AI(grid) { this.grid = grid; } // static evaluation function AI.prototype.eval = …

    Linux 2023年6月13日
    0103
  • 分区表、文件系统等计算机基础知识

    开机固件 BIOS UEFI 特别老的BIOS不支持GPT分区 目前已取代BIOS 分区表类型 MBR GPT 1.不支持2TB以上的硬盘2.主分区不能超过4个3.可以通过建立扩展…

    Linux 2023年6月7日
    0106
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球