微服务架构项目搭建过程中的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)

大家都在看

  • flask的使用

    python网站开发框架: django:大而全 flask:小而精 flask的web服务器:werkzeug 模板语法: jinjia2,兼容dtl 登录案例: from fl…

    Linux 2023年6月14日
    0110
  • springboot 工程出现 socket hang up

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

    Linux 2023年6月8日
    0116
  • Java动态脚本Groovy获取Bean(奇淫技巧操作)

    前言:请各大网友尊重本人原创知识分享,谨记本人博客: 南国以南i 背景: 在Java代码中当我们需要一个Bean对象,通常会使用spring中@Autowired注解,用来自动装配…

    Linux 2023年6月14日
    0111
  • 【MQTT】在Linux使用MQTT上报温度到阿里云

    MQTT上报温度到阿里云 * – 前言 – iniparser配置文件 – cJSON – sqlite3数据库 – 流…

    Linux 2023年6月13日
    0109
  • SpringBoot入门 ->(个人学习记录笔记)

    1. 入门 1.1 导入依赖 所有springboot工程都必须继承spring-boot-starter-parent org.springframework.boot spri…

    Linux 2023年6月8日
    073
  • SpringBoot-MVC自动配置原理

    MVC自动配置原理 5.1 官网阅读 在进行项目编写前,我们还需要知道一个东西,就是SpringBoot对我们的SpringMVC还做了哪些配置,包括如何扩展,如何定制。 只有把这…

    Linux 2023年6月14日
    0109
  • Centos 6 DNS 配置 解决 Unknown host

    测试服务器Maven 打包时遇到了如下的错误 看上去应该是对 maven.aliyun.com的DNS 域名解析出问题了。 登录到服务器上 ping maven.aliyun.co…

    Linux 2023年5月27日
    0108
  • 等保测评2.0:Windows安全审计

    1、应启用安全审计功能,审计覆盖到每个用户,对重要的用户行为和重要安全事件进行审计 方案: 在管理工具打开本地安全策略,打开路径:安全设置\本地策略\审核策略,将全部审核策略配置为…

    Linux 2023年6月8日
    089
  • 【原创】Linux v4l2框架分析

    背景 Read the fucking source code! –By 鲁迅 A picture is worth a thousand words. –…

    Linux 2023年5月27日
    081
  • TCP三次握手 四次挥手

    最近在恶补计算机网络方面的知识,之前对于TCP的三次握手和四次分手也是模模糊糊,对于其中的细节更是浑然不知,最近看了很多这方面的知识,也在系统的学习计算机网络,加深自己的CS功底,…

    Linux 2023年6月7日
    091
  • 从磁盘删除Ubuntu出现的问题

    问题描述:Win10+Ubuntu双系统,利用磁盘管理工具删除了Ubuntu占用的磁盘,导致开机直接进入Grub界面,并且启动项仍有Ubuntu。 问题解决: 开机进入BIOS或启…

    Linux 2023年6月14日
    0107
  • conda 和 pip 的具体区别

    pip install 安装包时不会自动安装所需的其他依赖包,只是在缺少其他依赖包时作错误提示,这时需要手动安装其他依赖包 pip 不会将python看成包,不能对环境中的pyth…

    Linux 2023年6月7日
    095
  • python 练习题:请利用循环依次对list中的每个名字打印出Hello, xxx!

    方法一: python;gutter:true; -<em>- coding: utf-8 -</em>- 请利用循环依次对list中的每个名字打印出Hel…

    Linux 2023年6月8日
    0104
  • 从零开始制作一个linux iso镜像

    一、前言 对于一个极简化的linux系统而言,只需要三个部分就能组成,它们分别是一个linux内核、一个根文件系统和引导。以下是本文制作linux iso镜像所用到的系统和软件: …

    Linux 2023年5月27日
    094
  • mycat2 读写分离配置(详解)

    mycat2相对mycat1来说升级还挺多的,但是全网资料太少了,这里尽可能详细的将读写分离说清楚,目前这套配置已经在我司生产环境应用,日UV6W左右,暂时没发现问题。 1.1下载…

    Linux 2023年6月6日
    0111
  • Linux防火墙——iptables简介

    一、防火墙相关概念 这里描述了一些相关的概念。 [En] Some related concepts are described here. 从逻辑上讲,防火墙可以分为主机防火墙和…

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