How to install binary MySQL on Linux and crack MySQL password

How to install binary MySQL on Linux and crack MySQL password

1. Make sure the system has the required libaio software. If not:

yum -y install libaio

2. Unpack the binary MySQL package

tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local

3. Enter /usr/local

cd /usr/local

4. Change the name of the software package or create a soft link

mv mysql-5.7.24-linux-glibc2.12-x86_64/mysql
  ln -s mysql-5.7.24-linux-glibc2.12-x86_64/mysql

5. Add mysql user and group

useradd -M -s /sbin/nologin mysql

6. Change the current directory owner to the newly created mysql user

chown -R mysql:mysql /usr/local/mysql

7. Initialize the MySQL database (create default libraries and tables)

 /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize

After initializing the database, a password will be generated at the end. Remember this password and use it to enter the database.

8. Modify /etc/my.cnf file

  vim /etc/my.cnf
 [mysqld]
 datadir=/usr/local/mysql/data
 socket=/tmp/mysql.sock
 [mysqld_safe]
 log-error=/usr/local/mysql/data/mysql.log
  pid-file=/usr/local/mysql/data/mysql.pid

9. Add mysql service to system services

cp mysql/support-files/mysql.server /etc/init.d/mysqld
 chown +x /etc/init.d/mysqld
 chkconfig --add mysqld

10. Open mysql

systemctl start mysqld

Check whether the service is enabled: netstat -lnpt |grep 3306

11. Create a soft link:

ln -s /usr/local/mysql/bin/* /bin/

12. Enter the mysql database:

mysql -uroot -p'初始化生成的密碼'

exit Exit the database

13.Change mysql password;

 mysqladmin -uroot -p 'Initial generated password' password 'The password you want to change'

==============================================================================

If you forget your mysql password:

1. Stop mysql first:

systemctl stop mysqld

2. Make sure there are no processes related to mysql:

ps aux |grep mysqld

3. Skip the authorization table to start the service:

mysqld_safe --skip-grant-tables & (放到后臺去運行)

mysql directly enter the mysql database

mysql>show databases;
+-----------------------------+
| Database |
+-----------------------------+
| information_schema |
|mysql |
| performance_schema |
|sys|
+-------------------------------+
4 rows in set (0.01 sec)
mysql> use mysql
mysql> show tables;
mysql> desc user;
mysql> select user,authentication_string (to save password) from user;
mysql>update user set authentication_string=PASSWORD('the password you want to set') where user='root';
mysql>flush privileges; (refresh authorization table)
mysql>exit

Kill the process after exiting

ps aux |grep mysqld

kill -9 process number

Then start the service: systemctl start mysqld

Summarize

The above is the method of installing binary MySQL on Linux and cracking MySQL password introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time!

You may also be interested in:
  • When a Linux (Ubuntu) user enters an incorrect password N times in a row to log in, the system will be automatically locked for X minutes
  • Detailed explanation of SSH password-free login configuration under Linux
  • Forgot the root password in Linux? Enter single user mode Switch run level Switch user
  • Solution to forgetting the password of the pagoda panel in Linux 3.X/4.x/5.x

<<:  MySQL data migration using MySQLdump command

>>:  Deleting the database and running away? How to use xtraback to back up the MySQL database

Recommend

js implements a simple calculator

Use native js to implement a simple calculator (w...

Basic ideas and codes for implementing video players in browsers

Table of contents Preface Summary of audio and vi...

Vue implements custom "modal pop-up window" component example code

Table of contents Preface Rendering Example Code ...

Using css-loader to implement css module in vue-cli

【Foreword】 Both Vue and React's CSS modular s...

MySQL changes the default engine and character set details

Table of contents 1. Database Engine 1.1 View dat...

Implementation of Nginx domain name forwarding https access

A word in advance: Suddenly I received a task to ...

Detailed explanation of JavaScript function introduction

Table of contents Function Introduction function ...

Solve the MySQL 5.7.9 version sql_mode=only_full_group_by problem

MySQL 5.7.9 version sql_mode=only_full_group_by i...

Detailed process of drawing three-dimensional arrow lines using three.js

Demand: This demand is an urgent need! In a subwa...

Introduction to Apache deployment of https in cryptography

Table of contents Purpose Experimental environmen...

How to move a red rectangle with the mouse in Linux character terminal

Everything is a file! UNIX has already said it. E...

Mysql modify stored procedure related permissions issue

When using MySQL database, you often encounter su...

HTML form tag tutorial (2):

This tutorial introduces the application of vario...

Detailed explanation of the wonderful uses of SUID, SGID and SBIT in Linux

Preface Linux's file permission management is...