LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1121|回复: 9

用shell脚本来实现mysql查询可以麽?

[复制链接]
发表于 2004-3-3 17:30:00 | 显示全部楼层 |阅读模式
我需要通过查询mysql来实现身份验证。
如果用shell脚本来实现的话,如何判断mysql客户端的查询结果呀???
不行就只好用c写了。可是我的c水平.......
发表于 2004-3-3 17:44:27 | 显示全部楼层
晕~~~,让熟悉mysql的兄弟来解决吧 :sorry
发表于 2004-3-3 19:39:22 | 显示全部楼层
mysql 没用过, PostgreSQL 可以
发表于 2004-3-3 20:57:01 | 显示全部楼层
哇!好主意

具体怎么实现啊?等待ing......
发表于 2004-3-3 21:00:50 | 显示全部楼层
好像用mysql 就可以了, 不然用perl / python 可以嗎?
发表于 2004-3-3 23:08:28 | 显示全部楼层
具体是什么应用呢,说来听听?
发表于 2004-3-4 07:59:19 | 显示全部楼层
比如有個vbb 的 db, 想看icon 的內容
  1. mysql -D vbb -e "SELECT  * FROM  `icon` "
复制代码

可以看到

  1. +--------+-------------+-------------------------+
  2. | iconid | title       | iconpath                |
  3. +--------+-------------+-------------------------+
  4. |      1 | Post        | images/icons/icon1.gif  |
  5. |      2 | Arrow       | images/icons/icon2.gif  |
  6. |      3 | Lightbulb   | images/icons/icon3.gif  |
  7. |      4 | Exclamation | images/icons/icon4.gif  |
  8. |      5 | Question    | images/icons/icon5.gif  |
  9. |      6 | Cool        | images/icons/icon6.gif  |
  10. |      7 | Smile       | images/icons/icon7.gif  |
  11. |      8 | Angry       | images/icons/icon8.gif  |
  12. |      9 | Unhappy     | images/icons/icon9.gif  |
  13. |     10 | Talking     | images/icons/icon10.gif |
  14. |     11 | Red face    | images/icons/icon11.gif |
  15. |     12 | Wink        | images/icons/icon12.gif |
  16. |     13 | Thumbs down | images/icons/icon13.gif |
  17. |     14 | Thumbs up   | images/icons/icon14.gif |
  18. +--------+-------------+-------------------------+
复制代码
 楼主| 发表于 2004-3-4 08:57:12 | 显示全部楼层
现在是这样的。
我是想要通过查询mysql来实现身份验证。
比如一个用户名是tom.
查询后,如果数据库中有tom这个纪录,那么就执行后面的操作。
如果没有,那么退出。
 楼主| 发表于 2004-3-4 09:22:40 | 显示全部楼层
使用前面朋友的方法,我写了这样一段脚本
mysql>/tmp/temp -h hostip -u username databasename -p -e "select * from tablename"<<EOF
password
EOF
可是执行这段脚本后还要我输入口令。
如何才能自动的把口令输入进去呀????
发表于 2004-3-4 12:58:21 | 显示全部楼层
$ mysql -h hostname -u username -p password ...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表