I want to do a select into outfile on a scheduled basis. I can enter the commands select into outfile "/usr/local/whatever_file.txt" from my_database_table where whatever conditions; and the command works fine in the mysql shell. How can I execute it in crontab on linux redhat? It keeps giving me the reply unexpected token at 'into'
Do I need to do some kind of piping or redirection Myshell script looks kike this:
#!/bin/sh
cd /usr/local/mysql/bin;
./mysql -u anybody -h whoever --password=woopie;
select * into outfile '/usr/local/whatever_file.txt' fields terminated by ',' lines terminated by "\n" from databasename.tablename where NewReading != 0;
And I even did a chmod on the file to make it 777.
Do I need to do some kind of piping or redirection Myshell script looks kike this:
#!/bin/sh
cd /usr/local/mysql/bin;
./mysql -u anybody -h whoever --password=woopie;
select * into outfile '/usr/local/whatever_file.txt' fields terminated by ',' lines terminated by "\n" from databasename.tablename where NewReading != 0;
And I even did a chmod on the file to make it 777.