shell mysql eof_shell EOF
1、考慮下面的需求,在主shell執(zhí)行命令,進(jìn)入其他的命令,后面的輸入,想作為命令的輸入,而不是主shell的輸入,怎么辦?
2、使用<
3、這里的EOF只是分界符,使用其他的字符也可以。
4、比如cat,不使用EOF,如下:
[root@localhost ~]# cat >111.txt
abcd
1234
[root@localhost ~]# more 111.txt
abcd
1234
使用EOF
[root@localhost ~]# cat >111.txt<
> aaaa
> bbbb
> EOF
[root@localhost ~]# more 111.txt
aaaa
bbbb
5、mysql安裝后之后,忘記密碼,可使用說(shuō)下面的腳本,如下:
/etc/init.d/mysqld stop
service mysqld start --skip-grant-tables
sleep 4
mysql -hlocalhost << EOF
update mysql.user set password=password('123456') where user ='root';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
EOF
/etc/init.d/mysqld restart
總結(jié)
以上是生活随笔為你收集整理的shell mysql eof_shell EOF的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: python中不论类的名字是什么歌_Py
- 下一篇: python的lib文件夹_python