#!/bin/bash
MYSQL_INSTALL_DIR="/usr/local/mysql56"
MYSQL_CNF="${MYSQL_INSTALL_DIR}/my.cnf"
MYSQL_SERVER_NAME="mysqld"
# 检查是否是root用户
if [ $(id -u) != "0" ]; then
echo "must root"
exit 1
fi
echo "+-------------------------------------------------------------------+"
echo "| Reset MySQL Root Password"
echo "+-------------------------------------------------------------------+"
if [ -s "${MYSQL_INSTALL_DIR}/bin/mysql" ]; then
DB_Name="mysql"
DB_Version=$($MYSQL_INSTALL_DIR/bin/mysql_config --version)
else
echo "MySQL not found!"
exit 1
fi
while :; do
DB_Root_Password=""
read -p "Enter New ${DB_Name} root password: " DB_Root_Password
if [ "${DB_Root_Password}" = "" ]; then
echo "Error: Password can't be NULL!!"
else
break
mysql5.6.x的数据库找回-(shell9)
最新推荐文章于 2024-04-17 09:48:24 发布