Home > Database > Mysql Tutorial > body text

MySQL用户密码中的特殊字符叹号(!)的妙用_MySQL

WBOY
Release: 2016-06-01 13:05:30
Original
806 people have browsed it

使用叹号(!)禁止用户终端进入的一个方法。

代码如下:


mysql> grant all privileges on wubx.* to ‘wubx'@'172.16.100.185′ identified by ‘fd52!wubx&,';
Query OK, 0 rows affected (0.00 sec)
mysql>quit;
#mysql -h 172.16.100.185 -u wubx -pfd52!wubx&,
-bash: !wubx@,: event not found


仔细看一下,原来他把!后面的字符串做为命令执行了。又试了一个Navicat的管理端,也一样存在密码不正常的问题。

在测一下程序方面是不是可以用,写一个PHP测一下。

代码如下:


$link = mysql_connect('172.16.100.185′,'wubx','fd52!wubx&,');
if (!link){
die(‘Could not connect:'.mysql_error());
}
echo ‘Connected successfully';mysql_close($link);
?>
#php testdb.php
Connected successfully


还看程序中能正常识别。
PHP还是可以OK通过的。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template