Use of switches in command line
Here are some interesting switches that can be helpful..-N removes header
-s removes separator chars
-r raw output
exemple
if you need to get the result of a count(*)
mysql -uusername -ppassword -N -s -r -e 'select count(*) from user'
if you get the ERROR : 2003 you may need to add more options like the port number and the socket
mysql --port=$MYSQL_PORT --socket=$MYSQL_SOCKET -uroot -p -Dmysql -h localhost -N -s -r -e 'select count(*) from user'
No comments:
Post a Comment