doudu161481 2012-12-19 17:33 采纳率: 100%
浏览 68
已采纳

cronjob命令行用SQL查询更新PHPmyAdmin数据库

In Bluehost under the cronjob task list I have set up a job that executes every minute.

mysql --user=myusername --password=mypassword use mydb 
       -e "UPDATE `users` SET val = '1' WHERE name = 'matt'"

I believe I am not selecting the database properly as I am using the same username and pass to log into PHPmyAdmin and the SQL query works fine once I have logged into PHPmyAdmin.

Where is the mistake?

  • 写回答

2条回答 默认 最新

  • dongyun8138 2012-12-19 17:39
    关注

    the command line should be

    mysql --user=myusername --password=mypassword -D mydb -e "UPDATE `users` SET val = '1' WHERE name = 'matt'"
    

    the -D databasename parameter is what you are looking for

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?