Em Andamento

write command: Running mysql from ssh & query statement has a Text Header in the SELECT statement that needs quotes.

I have an mySQL statement that works locally:

mysql -u root -ppassword -e 'SELECT "Column 1 text" as "Column 1 Heading", table1.* FROM table1;' dataBase1

If I try and run it with SSH, it errors out. I don't know how to get the quote in the SQL statement through SSH.

ssh server1 "mysql -u userName -ppassword -e 'SELECT 'Column 1 text' as 'Column 1 Heading', table1.* FROM table1;' dataBase1"

Just need the command written correctly so it runs on the command line. No changes to the system are allowed.

OS:

Linux version [url removed, login to view] () (gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP Fri Oct 22 15:27:53 UTC 2010

mySQL:

"protocol_version" "10"

"version" "5.1.51-log"

"version_comment" "Source distribution"

"version_compile_machine" "i386"

"version_compile_os" "redhat-linux-gnu"

Thanks,

~Donavon

Habilidades: Linux, MySQL, Administrador do Sistema, UNIX

Ver mais: pae, how to write on line, from quotes, mysql 5.1, how to write statement, write query, ssh, smp, select, log out from, command, mysql select statement, run command linux, command command, mysql quote, ssh linux, 2013 query, column text, redhat linux gnu, query text mysql, command line written, red hat linux i686, write linux command, i686 redhat linux gnu, system distribution mysql

Acerca do Empregador:
( 17 comentários ) Pasadena, United States

ID do Projeto: #5141352

Premiar a:

czrain

This project is actually so silly that I'll give you the solution right here (and explain). :P What ssh does is connect to server1 and run the command with a shell ... After being parsed by the local shell. That mea Mais

$15 USD em 1 dia
(0 Avaliações)
0.0

19 freelancers are bidding on average $17 for this job

linuxfreak1985

Hi there, I have over 7 years experience working on HTML, Wordpress, Magento, Database administration, OpenCart, Website Design, Logo / Banner Design Joomla, CSS and Linux Administration. I have read the project descri Mais

$23 USD em 1 dia
(270 Comentários)
7.4
dungvit85

I can help you to do this job right now. lets start. thanks ------------------------------------------------------------------------------------

$25 USD in 3 dias
(29 Comentários)
4.8
PerlIsFun

Should really be an easy going quiz time :) I'd be glad to help, and I'm definitely sure I have the solution ;) Thank you.

$15 USD in 0 dias
(13 Comentários)
4.6
gkan1234

Hi I have 3+ years experience in MySQL and Linux. I will help you sort this out. Please let me know if you are interested. Thanks

$25 USD in 0 dias
(13 Comentários)
3.8
msteidley

I usually do something like this and escape the command watching for asterisks and the like that the shell will try to interpret. echo "escaped_command" | ssh user@host $(< /dev/fd/0)

$15 USD em 1 dia
(6 Comentários)
3.8
matrafox

Hello Well you have to try something like this ssh server1 "mysql -u userName -ppassword -e 'SELECT \"Column 1 text\" as \"Column 1 Heading\", table1.* FROM table1;' dataBase1" You have to keep your existing Mais

$10 USD em 1 dia
(5 Comentários)
3.3
NayaPakistan

A proposal has not yet been provided

$10 USD em 1 dia
(8 Comentários)
3.1
icladmin

Hi, we have most experience PHP, Word Press ,.Net team with java script and jQuery, SQL server 2008. I really want to join your job. and I am looking for long-term relation ship in this job too. I'll complete your tas Mais

$34 USD in 3 dias
(1 Comentário)
2.4
diegofpr

Hi, it should be: ssh server1 "mysql -u userName -ppassword -e 'SELECT \"Column 1 text\" as \"Column 1 Heading\", table1.* FROM table1;' dataBase1" Regretfully I do not have a linus at my disposal, so I hope you Mais

$10 USD em 1 dia
(2 Comentários)
2.2
svoyski

Hello. Try this: echo "SELECT 'Column 1 text' as 'Column 1 Heading', table1.* FROM table1;" | ssh mysql -uuserName -ppassword dataBase1

$25 USD in 3 dias
(1 Comentário)
2.0
helixultrax

A proposal has not yet been provided

$15 USD em 1 dia
(0 Comentários)
0.0
gejoen

I'm experienced in shell programming and with ssh - this is what I do everyday on my job. Here in Germany it's after midnight now, that's why i terminate this message with GOOD NIGHT :-)

$10 USD em 1 dia
(0 Comentários)
0.0
markpowers

Hi! Try this: ssh server1 "mysql -u userName -ppassword -e 'SELECT \"Column 1 text\" as \"Column 1 Heading\", table1.* FROM table1; dataBase1'" I tried to simulate a setup more or less the same on my laptop, a Mais

$10 USD em 1 dia
(0 Comentários)
0.0
Mulder1

Hi! I have a large experience in LAMP environments. I am new here on freelancer, so I want to gain reputation and get a good opinion from you.

$25 USD in 3 dias
(0 Comentários)
0.0
fasmwexegaart

I've done this before. Contact me and I'll teach you how to escape arguments with ssh, or with any unix command, for that matter.

$15 USD em 1 dia
(0 Comentários)
0.0
yadavsms

working in linux,And handing the servers over ssh and also handle the mysql database for the main website of the company.

$20 USD in 3 dias
(0 Comentários)
0.0
rotan4ik

I know what to do. Firstly, you must have permission to execute mysql on remote host. And Secondly, you have some mistakes in you command. It must be like this: ssh username@HOST "mysql -u root -e 'Select ''123'' as Mais

$10 USD in 3 dias
(0 Comentários)
0.0
oobretenov

I Could help you. Mais

$20 USD em 1 dia
(0 Comentários)
0.0