当前位置:网站首页>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 do reverse domain name resolution? What does reverse domain name resolution mean?
- How to register the company domain name mailbox? Is the operation process complicated
- My two-year persistence is worth it!
- Collateral damage from DDoS and hacktivism
- Less network card filters
- Working principle and type selection of signal generator
- How to apply for web domain name what is the role of domain name
- What is the reason why the list of channels on the left side of easycvr video Plaza displays garbled codes?
- Risc-v assembly language programming (2) assembly program ASM_ run_ led
- What happened to the JVM locking on Tencent ECS?
猜你喜欢
随机推荐
Load balancing on Tencent cloud
How is a Clickhouse query completed?
At the trusted cloud conference, Tencent securely unlocked a number of new certifications!
How to resolve the domain name? How to choose a domain name?
Basic concepts of complex networks
Koa middleware implementation
Realization of data transmission between a and B computers by using single chip microcomputer serial port
The errorcontrol registry of the third-party service is 3, which may cause the system to cycle restart. For example, ldpkit introduced by WPS
How does the company domain name come from? What kind of domain name is a good domain name
How to resolve Chinese domain names? What is domain name resolution?
How to make a website with a domain name? What are the functions of the website?
The development and construction of live broadcast app, and the source code of live broadcast app involves all aspects
Tencent cloud won the "best customer value award for security hosting services in China" from Sullivan toubao Research Institute
Why do the new generation of highly concurrent programming languages like go and rust hate shared memory?
How to resolve the primary domain name and how to operate it
Flutter - date of birth calculation age tool class
Some common IPv6 problems!
New core and new speed - next generation standard O & M engine
How to apply for a domain name? How much does it cost to apply for a domain name?
Malicious software packages are found in pypi code base. Tencent security threat intelligence has been included. Experts remind coders to be careful of supply chain attacks



