mysql 登录提示甚至不提供密码,如果提供如mysql -u root -p提示输入密码,如果提供如mysql -u root无需输入密码即可登录,我已运行查询
select user,hosts from mysql.user;
Run Code Online (Sandbox Code Playgroud)
并知道有 3 个具有不同主机的 root 用户,如图所示
+------+-------------+
| user | host |
+------+-------------+
| root | 127.0.0.1 |
| root | db-busindia |
| root | localhost |
+------+-------------+
Run Code Online (Sandbox Code Playgroud)
有趣的是,mysql 服务器名称也是 db-busindia ,是root@'db-busindia'罪魁祸首吗?
我是perl的新手,我试图将一些数据插入哈希,但卡住,帮助表示赞赏....
我有以下数据
Catalog database partition number = 0
Snapshot timestamp = 02/23/2013 21:02:08.262661
Number of automatic storage paths = 1
File system ID = 2304
Storage path free space (bytes) = 1385955328
File system used space (bytes) = 26495475712
File system total space (bytes) = 27948539904
High water mark for connections = 82
Application connects = 32747
Secondary connects total = 3
Applications connected currently = 22
Appls. executing in db manager currently = 1
Agents associated with applications = …Run Code Online (Sandbox Code Playgroud) 我只想在1到5之间给出输入时进入循环,否则它应该要求"输入有效选项:"
这是我尝试过的
#!/usr/bin/perl
use strict;
use warnings;
use Switch;
print qq/\tMENU\n 1.BACKUP\n 2.RESTORE\n 3.TABLESPACES\n 4.BUFFERPOOLS\n 5.EXIT\n/;
print "Enter Your Choice : ";
while(<STDIN>){
chomp;
if (1..5){
print qq/wright\n/;
} else {
print qq/wrong\n/;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在中途,我试图检查它是否工作,但它不是......即使我给6或7 ......作为输入它给予写,我的意思是它进入如果循环而不是其他........帮助是赞赏........
我必须检查磁盘卷上的可用空间并使用df -h生成此输出的命令
Filesystem Size Used Avail Use% Mounted on
/dev/md0 27G 24G 2.1G 92% /
udev 506M 112K 506M 1% /dev
/dev/sda1 102M 40M 63M 39% /boot
Run Code Online (Sandbox Code Playgroud)
这篇剧本
my (@space, @freesp);
@space = grep /\/dev\/md0/,`df -h`;
print "@space\n";
Run Code Online (Sandbox Code Playgroud)
给了我
/dev/md0 27G 24G 2.1G 92% /
Run Code Online (Sandbox Code Playgroud)
我可以在空白上分割出值$freesp[0],$freesp[1]等等.
但我想G用空格删除或替换它,以便我可以比较$freesp[3]一些值,并可以继续我的脚本.
那么我必须使用的正则表达式是什么,或者还有其他更好的方法吗?
这段代码对我有用,但我正朝着我提到的方向前进.
#!/usr/bin/perl
use strict;
use warnings;
my (@space, @freesp);
@space = grep /\/dev\/md0/, `df`;
print "@space\n";
for (@space) {
chomp;
@freesp = …Run Code Online (Sandbox Code Playgroud)