Maison > base de données > tutoriel mysql > le corps du texte

账号密码包含反斜线时如何办

WBOY
Libérer: 2016-06-07 14:51:39
original
1122 Les gens l'ont consulté

问: 假如密码中包含反斜线,该如何处理呢? 答: 在mysql中,反斜线"\"是有特殊意义的,用于转义,因此假如密码中包含"\",就须要特别留心。有一种一劳永逸的方法,就是在密码中不用反斜线,哈哈。另一种,那就是须要多加多个反斜线,例如: (root:hostname


  问: 假如 密码中包含反斜线,该如何 处理呢?
  答: 在mysql中,反斜线"\"是有特殊意义的,用于转义,因此假如 密码中包含"\",就须要 特别留心 。有一种一劳永逸的方法 ,就是在密码中不用反斜线,哈哈。另一种,那就是须要 多加多个 反斜线,例如:
(root:hostname:Thu Oct 15 09:15:38 2009)[mysql]> grant usage on *.* to yejr@localhost identified by 'ye\\\jr'; <br>Query OK, 0 rows affected (0.02 sec) <br>(root::Thu Oct 15 09:16:22 2009)[mysql]> select password('ye\jr'); <br>+-------------------------------------------+ <br> password('ye\jr')              <br>+-------------------------------------------+ <br> *9DB91006131E32B22135599033C6A9C196EC3C6B  <br>+-------------------------------------------+ <br>1 row in set (0.00 sec) <br>(root::Thu Oct 15 09:23:32 2009)[mysql]> select host,user,password from user where user='yejr';     <br>+-----------+------+-------------------------------------------+ <br> host    user  password                  <br>+-----------+------+-------------------------------------------+ <br> localhost  yejr  *F06D79D5F57894772B64BF3164ABB714EBDBD3E2  <br>+-----------+------+-------------------------------------------+ <br>1 row in set (0.01 sec) <br>(root::Thu Oct 15 09:16:28 2009)[mysql]> select password('ye\\\jr'); <br>+-------------------------------------------+ <br> password('ye\\\jr')             <br>+-------------------------------------------+ <br> *F06D79D5F57894772B64BF3164ABB714EBDBD3E2  <br>+-------------------------------------------+ <br>1 row in set (0.01 sec) <br>[@tc_10.11.54.224_cnc ~]# mysql -uyejr -p'ye\jr' <br>Logging to file '/home/mysql/query.log' <br>Welcome to the MySQL monitor. Commands end with ; or \g. <br>Your MySQL connection id is 63 <br>Server version: 5.x.x-percona-highperf-x-log MySQL Percona High Performance Edition (GPL) <br>Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. <br>(yejr::Thu Oct 15 09:24:58 2009)[(none)]> Bye 
从上面的例子可以看到,假如 密码中有反斜线,就须要 在它前面再加2个反斜线。

  

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!