打开mysql命令行输入
USE mysql
SELECT * FROM USER
命令点击运行,进入到mysql用户配置目录下
然后在下方输入下列代码其中123456代码新密码,root代表修改密码账号名称
UPDATE USER SET PASSWORD=PASSWORD('123456') WHERE USER='root'
点击执行
修改密码完成,点击电脑左下角【开始菜单】,找到【运行】选项,点击打开
在d出的运行对话框中输入 services.msc 命令,点击确定进入服务界面
进入服务项界面,找到【MySql】服务,双击打开
进入服务配置对话框,将该服务重新启动(否则新密码无法登陆)
打开mysql,安装以前的密码登录就会提示下图对话框说明我们密码已经修改成功,输入新密码点击登录即可
同步数据库自动化脚本#!/bin/sh
read -p "Please keyin your ssh host:" -t 30 host_ipread -p "Please keyin your ssh user:" -t 30 usernameread -p "Please keyin your ssh pass:" -t 30 passwordread -p "Please keyin your sync table list,separated by spaces:" -t 30 table_listdatetime=`date +%Y%m%d%H%M%S`
src_file="/tmp/data_$datetime.sql"
tar_file="/tmp/data_$datetime.tar.gz"
mysqldump -h127.0.0.1 -uroot -ppass database_name $table_list >$src_filetar czvf $tar_file $src_file
./expect_scp.sh $host_ip $username $password $tar_fileexpect_scp.sh代码
#!/tools/bin/expect
set timeout 10
set host [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set src_file [lindex $argv 3]
#set dest_file [lindex $argv 4]
spawn scp $src_file $username@$host:/home/$usernameexpect {
"(yes/no)?"
{
send "yes\n"
expect "*assword:" { send "$password\n"}
}
"*assword:"
{
send "$password\n"
}
}
expect "100%"
expect eof
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)