MySQL Execute From Command Line

General discussion forum for the Zend Server - The full, commercial edition

MySQL Execute From Command Line

Postby justbn on Wed Jun 20, 2012 11:40 pm

I've got Zend Server Community Edition on my Mac.

I need to execute a MySQL query from the terminal command line (not the mysql command line). On ALL of my servers with a traditional LAMP stack (not Zend Server), I can execute queries like this :

$ mysql -u USER_NAME -p PASSWORD -hSERVER_NAME -PTHE_PORT -e "SELECT NOW();"

On ALL of my other servers, I get this response :
+---------------------+
| NOW() |
+---------------------+
| 2012-06-20 18:34:21 |
+---------------------+
$


On my Mac with Zend server, I get:
ERROR 1049 (42000): Unknown database 'NOW();'


If I use any other command such as this one on a non-Zend server, I get a valid response:

mysql -u USER_NAME -p PASSWORD -hSERVER_NAME -PTHE_PORT -e"use stp_downloads; select * from downloads limit 2;"
+--------------+-------------+---------------------+-----------------+
| downloads_id | statuses_id | download_stamp | order_number |
+--------------+-------------+---------------------+-----------------+
| 10001 | 5 | 2011-04-04 22:17:29 | DOWN00000004753 |
| 10002 | 5 | 2011-04-04 22:29:06 | DOWN00000004754 |
+--------------+-------------+---------------------+-----------------+

If I run that command on my Mac with Zend server, I get :
/usr/local/zend/mysql/bin/mysql.client Ver 14.14 Distrib 5.1.54, for apple-darwin9.8.0 (i386) using readline 5.1
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Usage: /usr/local/zend/mysql/bin/mysql.client [OPTIONS] [database]
Followed by all the usage info.


Why can't MySQL on Zend Server properly process SQL statements using -e or --execute??

What am I doing wrong??


Thanks,
Justin
justbn
 
Posts: 2
Joined: Wed Jun 20, 2012 11:24 pm

Re: MySQL Execute From Command Line

Postby justbn on Thu Jun 21, 2012 12:43 am

UPDATE : This definitely seems to be something with MySQL configuration with Zend Server. I got fed up and installed the MySQL 5.5.25 DMG for the Mac. If I use the new path to the mysql client on my Mac, the queries run properly.

I couldn't find any my.cnf setting that would cause this. The MySQL docs don't mention any criteria for performing queries this way.
justbn
 
Posts: 2
Joined: Wed Jun 20, 2012 11:24 pm


Return to Zend Server

Who is online

Users browsing this forum: No registered users and 4 guests