CRON与CPanel

时间:2015-07-27 21:38:16

标签: mysql cron cpanel

我想通过CRON Cpanel执行SQL查询。

这是命令:

mysql --user=MYUSERNAME --password=MYPASSWORD --database=MYDATABASE \
    --execute="LOAD DATA INFILE '/usr/local/bin/php/home/MYFILE.csv' INTO TABLE MYDATABASE.MYTABLE charset 'utf8' FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' IGNORE 2 LINES".

以下是我收到的错误消息:

  

第1行的错误1045(28000):用户'MYUSERNAME'@'localhost'拒绝访问(使用密码:是)

2 个答案:

答案 0 :(得分:1)

经过多次尝试后,我找到了答案:我必须在CRON命令行的路径前放置\。我希望这对其他人有用。

I have replicated your scenario and it is perfectly working fine for me.
Below is some sample code.

**view:**
  <List
    headerText="Custom Content"
    id="IDCustomerListItem"
    items = "{oAppView>/modelData}">
    <CustomListItem type="Inactive">
               <CheckBox text="{oAppView>lastName}" selected="true" />
    </CustomListItem>
  </List>

**Controller**:
            var list,
            binding,
            filter;
            list = this.getView().byId("IDCustomerListItem");
            filter = new sap.ui.model.Filter("lastName",sap.ui.model.FilterOperator.Contains , "D");
            binding = list.getBinding("items");
            binding.filter(filter,"Application");
            binding.refresh(true);

答案 1 :(得分:0)

您需要向MYDATABASE授予MYUSERNAME权限。

如果您正在使用cPanel,请转到数据库工具并创建MYUSERNAME,然后授予其访问MYDATABASE的权限。

很多时候cPanel都会在用户名和数据库名前加上帐号名称,因此您可能需要将命令调整为:

mysql -u account_MYUSERNAME account_MYDATABASE(...)

请务必授予用户FILE权限 - https://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html#priv_file