mysql二进制安装与密码破解

文章目录

  • mysql二进制安装与密码破解
    • 1:二进制安装
    • 2:破解密码

1:二进制安装

进入包存放的路径


[root@localhost src]# cd /usr/src/

创建mysql的用户


[root@localhost src]# useradd -M -r -s /sbin/nologin mysql
[root@localhost src]# id mysql
uid=975(mysql) gid=974(mysql) 组=974(mysql)

将安装包解压至/usr/local


[root@localhost src]# tar xf mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz -C /usr/local/[root@localhost src]# cd /usr/local/
[root@localhost local]# ls
bin  etc  games  include  lib  lib64  libexec  mysql-5.7.37-linux-glibc2.12-x86_64  sbin  share  src
[root@localhost local]# ln -sv mysql-5.7.37-linux-glibc2.12-x86_64/ mysql
'mysql' -> 'mysql-5.7.37-linux-glibc2.12-x86_64/'
[root@localhost local]# ll
总用量 0
drwxr-xr-x. 2 root root   6 6月  22 2021 bin
drwxr-xr-x. 2 root root   6 6月  22 2021 etc
drwxr-xr-x. 2 root root   6 6月  22 2021 games
drwxr-xr-x. 2 root root   6 6月  22 2021 include
drwxr-xr-x. 2 root root   6 6月  22 2021 lib
drwxr-xr-x. 3 root root  17 3月   6 20:08 lib64
drwxr-xr-x. 2 root root   6 6月  22 2021 libexec
lrwxrwxrwx. 1 root root  36 7月  26 18:40 mysql -> mysql-5.7.37-linux-glibc2.12-x86_64/
drwxr-xr-x. 9 root root 129 7月  26 18:37 mysql-5.7.37-linux-glibc2.12-x86_64
drwxr-xr-x. 2 root root   6 6月  22 2021 sbin
drwxr-xr-x. 5 root root  49 3月   6 20:08 share
drwxr-xr-x. 2 root root   6 6月  22 2021 src
[root@localhost local]# 

修改目录/usr/local/mysql的属主属组


[root@localhost local]# chown -R mysql.mysql mysql
[root@localhost local]# ll mysql -d
lrwxrwxrwx. 1 mysql mysql 36 7月  26 18:40 mysql -> mysql-5.7.37-linux-glibc2.12-x86_64/

编写环境变量


[root@localhost local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost local]# . /etc/profile.d/mysql.sh
[root@localhost local]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

将mysql的头文件输出给系统


[root@localhost mysql]# ln -s  /usr/local/mysql/include  /usr/include/mysql
root@localhost mysql]# ll  /usr/include/
总用量 0
drwxr-xr-x. 4 root root 34 3月   6 20:13 gnome-boxes
lrwxrwxrwx. 1 root root 24 7月  26 18:46 mysql -> /usr/local/mysql/include

配置man帮助手册


[root@localhost mysql]# vim /etc/man_db.conf
MANDATORY_MANPATH                       /usr/local/mysql/man

增添额外库文件

[root@localhost mysql]# echo '/var/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
[root@localhost mysql]# ldconfig

建立数据存放目录


[root@localhost mysql]# mkdir /opt/data
[root@localhost mysql]# chown -R mysql.mysql /opt/data/
[root@localhost mysql]# ll /opt/
总用量 0
drwxr-xr-x. 2 mysql mysql 6 7月  26 18:58 data

初始化数据库


[root@localhost mysql]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
2022-07-26T10:59:26.939711Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-26T10:59:27.097891Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-26T10:59:27.122982Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-26T10:59:27.127555Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 043007c0-0cd2-11ed-b67d-000c295a7a3f.
2022-07-26T10:59:27.128074Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-26T10:59:27.670720Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-26T10:59:27.670745Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-26T10:59:27.671135Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-26T10:59:27.803704Z 1 [Note] A temporary password is generated for root@localhost: 9p4#<?1ipRus

生成配置文件


[root@localhost mysql]# vim /etc/my.cnf
[root@localhost mysql]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
sql-mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

配置服务启动脚本

[root@localhost mysql]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/opt/data

启动mysql


[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL SUCCESS!
[root@localhost ~]# ps -ef | grep mysql
root        2787       1  0 19:06 ?        00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data --pid-file=/opt/data/mysql.pid
mysql       2987    2787  0 19:06 ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/opt/data/mysql.pid --socket=/tmp/mysql.sock --port=3306
root        7158    2251  0 19:08 pts/0    00:00:00 grep --color=auto mysql
[root@localhost ~]# ss -antl
State                    Recv-Q                   Send-Q                                     Local Address:Port                                       Peer Address:Port                   Process
LISTEN                   0                        128                                              0.0.0.0:111                                             0.0.0.0:*
LISTEN                   0                        32                                         192.168.122.1:53                                              0.0.0.0:*
LISTEN                   0                        128                                              0.0.0.0:22                                              0.0.0.0:*
LISTEN                   0                        5                                              127.0.0.1:631                                             0.0.0.0:*
LISTEN                   0                        80                                                     *:3306                                                  *:*
LISTEN                   0                        128                                                 [::]:111                                                [::]:*
LISTEN                   0                        128                                                 [::]:22                                                 [::]:*
LISTEN                   0                        5                                                  [::1]:631                                                [::]:*
[root@localhost ~]# 

2:破解密码

向mysql配置文件my.cnf中添加免除授权

[root@localhost ~]# vim /etc/my.cnf
skip-grant-tables

添加后报错缺少东西那就去下

root@localhost mysql]# mysql
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[root@localhost mysql]# dnf -y install libncurses.so.5*
上次元数据过期检查:1:01:05 前,执行于 2022年07月26日 星期二 18时49分17秒。
依赖关系解决。
已安装:ncurses-compat-libs-6.1-9.20180224.el8.x86_64                                                                                                                                                                     完毕!

再次登录

[root@localhost ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37 MySQL Community Server (GPL)Copyright (c) 2000, 2022, 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> 

修改mysql数据库root密码,并刷新权限

mysql>  update user set  authentication_string:=password ('XUANning@123') where user='root' and host='localhost';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

删掉配置文件里的跳过授权使用我们新修改的密码登录mysql,破解密码成功


[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
sql-mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
[root@localhost ~]# mysql -uroot -pXUANning@123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.37Copyright (c) 2000, 2022, 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> 

mysql数据库5.7版本二进制安装与破解mysql数据库密码相关推荐

  1. windows 7下如何卸载重装mysql 压缩包版百度经验_windows下安装、卸载mysql服务的方法(mysql 5.6 zip解压...

    MySQL是一个小巧玲珑但功能强大的数据库,目前十分流行.但是官网给出的安装包有两种格式,一个是msi格式,一个是zip格式的.很多人下了zip格式的解压发现没有setup.exe,面对一堆文件一头雾 ...

  2. 【工具安装】idea-2018.3.5版本下载安装以及破解过程

    idea-2018.3.5版本下载安装以及破解过程 1. 首先去官网下载idea https://www.jetbrains.com/idea/download 2. 安装:点开下载的idea安装包进 ...

  3. docker二进制安装mysql_Docker搭建MySQL读写分离主从模式 分布式数据库中间件Mycat分库分表应用...

    一.MySQL读写分离主从模式 1. 下载镜像 docker pull mysql 当前最新版本:mysql Ver 8.0.19 for Linux on x86_64 (MySQL Communi ...

  4. Mysql 5.6版本二进制安装

    时间:2018.7.30 作者:李强 参考:man,info,magedu讲义,万能的internet 实验环境:VMware® Workstation 12 Pro ,Centos 6.9,Cent ...

  5. xp 安装mysql数据库_Windows XP系统中安装MySQL5.5.28数据库图文教程

    Windows XP系统中安装MySQL5.5.28数据库图文教程 2014-07-13 16:35来源:中国存储网 导读:MySQL数据库的安装一共分为两个部分:数据库的安装和数据库的配置.一.My ...

  6. 二进制安装mysql集群_基于二进制安装Cloudera Manager集群

    一.环境准备 参考链接:https://www.cnblogs.com/zhangzhide/p/11108472.html 二.安装jdk(三台主机都要做) 下载jdk安装包并解压:tar xvf ...

  7. mysql 开启innodb win版本_MySQL安装与启动——Windows系统下

    以下书写结合菜鸟教程以及本人理解书写. 数据库下载(开源免费) MySQL数据库下载地址https://dev.mysql.com/downloads/mysql/ 可自由选择版本,一般选择Achiv ...

  8. windows server搭建php mysql数据库_windows server 2008/2012安装php iis7 mysql环境搭建教程...

    这篇文章主要为大家详细介绍了windows server 2008/2012安装php iis7 mysql环境搭建教程 ,需要的朋友可以参考下 windows server 2008/2012安装p ...

  9. MySql 5.7.26版本免安装版配置过程及相关问题解决(win10版)

    时间:2019年7月26日 目的:安装mysql解压版 一.下载安装 1.下载mysql5.7.26 下载地址:MySQL :: Download MySQL Community Server 下载完 ...

最新文章

  1. 【Android 进程保活】应用进程拉活 ( 账户同步拉活 | 账号添加 | 源码资源 )
  2. 数学之美 系列十一 - Google 阿卡 47 的制造者阿米特.辛格博士
  3. Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
  4. 计算机开机时间停在上次关机,怎么在电脑开机的时候查看上次关机前的操作
  5. python table_Python PrettyTable示例
  6. python是什么编程语言-Python是什么?可能是最受欢迎的编程语言
  7. zabbix3.2监控linux内存
  8. 浏览器,图片格式及特点
  9. Unity 光照贴图.hdr转.png解决方案
  10. python建模过程总结(一)
  11. RabbitMQ-彻底删除服务
  12. Python 内置函数详解
  13. 【机器学习】ROC曲线和AUC面积
  14. 得益乳业 × 奇点云 | 在线化业务GMV增长9倍是怎样炼成的?
  15. 测试:如何测试微信朋友圈的点赞功能
  16. 关于 移动硬盘数据丢失问题 的解决方法
  17. (C)输入一个字符串(串长不超过60),删除字符串中所有的空格符
  18. 泰坦尼克号Python数据分析
  19. gitlab服务器代码存储位置,gitlab仓库存储位置的修改方法
  20. 13 MATLAB 三维图形绘制

热门文章

  1. 错过的二十年后:香港的科技败局和AI未来
  2. 程序员埋逻辑炸弹,被判 6 个月
  3. Java 开发工具包 Java SE Development Kit 8/11LTS/15
  4. 数据挖掘一些面试题总结(Data Mining)
  5. (附源码)python方块新闻 毕业设计 091600
  6. 一位面试官询问我:Java中的JVM内存溢出和内存泄露是什么?我这么回答成功拿到了offer
  7. 视频教程-【吴刚大讲堂】Adobe Illustoator (AI)CC2019进阶与应用标准视频教程-Illustrator
  8. Python 关于下标的运用技巧(二分查找法,冒泡、选择、插入、归并、快速排序算法)
  9. PeckShield:2019年度区块链安全复盘总结暨区块链十大安全事件
  10. STM32_基础入门(三)_库函数按键实验