当前位置:网站首页>MySQL forgets root password cracking root password cracking all user passwords, shell script
MySQL forgets root password cracking root password cracking all user passwords, shell script
2022-06-24 06:03:00 【eisc】
#!/bin/bash
# mysql Crack reset root password
read -p "
Hello, welcome to continuous integration eisc.cn mysql Crack both remote and localhost Database password
Please enter a user name :" setuser
read -p " Please customize your password :" setpasswd
mycnf="/etc/my.cnf"
NR=`cat -n $mycnf | grep "\[mysqld\]" | awk -F" " '{print $1}'` ; echo $NR
# find [mysqld] The line of the tag
sed -i "/skip-grant-tables/d" $mycnf
# Delete this root Password free login configuration , To add
sed -i "$NR a skip-grant-tables" $mycnf ; systemctl restart mysqld mariadb
# stay mysqld Add password free login configuration information under the label
# Restart the database
echo " The information you entered is :$setuser $setpasswd"
mysqlversion=$(mysql -uroot -peisc.cn -e "select version();" | awk -F"." 'NR==2{print $1}') ; echo "mysql edition :$mysqlversion";
if [ $mysqlversion -gt 7 ];then
echo " The current database version is greater than 7"
mysql -e "use mysql;select user,authentication_string from user; set global read_only=0;set global read_only=1; set global validate_password.policy=0 ; set global validate_password.length=6;flush privileges;alter user '$setuser'@'localhost' identified by '$setpasswd';alter user '$setuser'@'%' identified by '$setpasswd';"
else
mysql -e "use mysql;select user,authentication_string from user; set global read_only=0;set global read_only=1; use mysql;select user,authentication_string from user; set global read_only=0;set global read_only=1; UPDATE user SET password=password('$setpasswd') WHERE user='$setuser';"
echo " lower than 7 Version cracking of "
fi
# Log in to the database to modify root The password for :eisc.cn
# a key :set global read_only=0;set global read_only=1; flush privileges;set global validate_password.policy=0 ; set global validate_password.length=6;
# Turn off the read-only property of the new master library , Read write properties , The length of the password is 6
sed -i "/skip-grant-tables/d" $mycnf; systemctl restart mysqld mariadb
# Delete the previous configuration , Restart the data
# wget eisc.cn/file/shell/mysql-passwd.sh ; sh mysql-passwd.sh边栏推荐
- How to resolve the primary domain name and how to operate it
- How to solve the enterprise network security problem in the mixed and multi cloud era?
- Material production tool manual
- Data warehouse data processing DB basic concept analysis and understanding OLAP OLTP hatp similarities and differences MPP architecture
- Why do the new generation of highly concurrent programming languages like go and rust hate shared memory?
- Cloud studio 2.0: the beginning of cloud
- ZABBIX enterprise distributed monitoring
- Script updates CLB type ingress Certificate in tke cluster
- Summary of basic notes of C language (III)
- Analysis of DDoS attack methods
猜你喜欢
随机推荐
As a sigmastar agent, Qiming cloud shares dry goods for you: what are the characteristics of ssd201/202
Groovy script engine practice in complex and changeable scenarios
How do individuals register domain names? What are the precautions for individual domain name registration?
Tomorrow, we will help farmers make their debut together!
How to register the company domain name mailbox? Is the operation process complicated
Tencent Anxin platform was officially released, and the "Anxin agricultural product plan" was launched at the same time, supporting the growth of 100 landmark agricultural product brands in three year
How do I view the IP address of a domain name? What is the relationship between domain name and IP?
How to build a website with a domain name? Is the website domain name free to use?
The company is worried about customer frustration and brand damage caused by DDoS Attacks
How to apply for a website domain name and what problems should be paid attention to
How about the work domain name? Does the work domain name need real name authentication?
Smart Logistics: with the advent of aiot era, how to get through the "last mile" of logistics?
PMP | 8 abilities that excellent project managers focus on training
Is the prospect of cloud computing in the security industry worth being optimistic about?
How to register an enterprise domain name? Can an enterprise domain name be directly registered by individuals?
Oceanus practice - develop MySQL CDC to es SQL jobs from 0 to 1
The website cannot be opened after windows installs the dongle
A network box that can adjust the outlet according to the router antenna position
Net domain name? Net domain name?
How to build a website with a domain name? What steps need to be taken?



