mysql show processes - process

I don't have phpMyAdmin installed on a ubuntu server but want to show all mysql processed. I know that you can do a "show_processes" in phpMyAdmin but how can I do it via shell?
Thanks

mysql -u USER -pPASS -P PORT -h HOST < "show processlist"
details:
-u = user
-p = password
-P = port number
-h = HOST
if you want to get the details via information_schema views,
sql="select * from information_schema.processlist where ???"
mysql -u USER -pPASS -P PORT -h HOST < $sql

mysql -uuser -p -e "show full processlist"
or
mysql -uuser -p -e "show processlist"

Related

Authentication using Windows cmd and Cypher Shell for Neo4j

When I connect to Cypher Shell using cmd, I type this:
bin\cypher-shell -u neo4j
Immediately after, I'm prompted for a password. I enter the password and connect to Cypher Shell. Yay!
Now, if I try to connect to Cypher Shell using cmd with this command:
bin\cypher-shell -u neo4j - p <password>
I'm given the error:
The client is unauthorized due to authentication failure
Can somebody explain to me why that is?
Thank you
Use the full connection string for cypher-shell can be in the format:
bin\cypher-shell -a <connection-URI>://<username>:<password>#<host><:port>
or
bin\cypher-shell -a <connection_uri> -u <username> -p <password>
For example:
bin\cypher-shell -a neo4j://neo4juser:neo4jpassword#127.0.0.1:7687
or
bin\cypher-shell -a neo4j://127.0.0.1:7687 -u neo4juser -p neo4jpassword

Send a dump that is exported from a remote server to an email

I already connected to remote server and exported that dump by this command "mysqldump -u user-p dbname > dump.sql" and now i want to send it through email and all these through SSH ... any help ??
Just a short one-liner:
ssh host "mysqldump -u user -p dbname >dump.sql &&
gzip -9 dump.sql &&
mailx -s sqldump -a dump.sql.gz recipient#some.domain </dev/null"

How to save a log of all psql queries AND the results

This question is similar to:
psql - write a query and the query's output to a file
However, their syntax doesn't work.
When I open a psql session from the command line, I'd like to save both the queries sent and the result.
The below code saves queries, but not output:
psql -h host -U username -p port -d database -L ~/file_to_save_output.txt
You can just redirect the output (STDOUT) using the > symbol like below. Redirection works in both Unix and Windows command prompt.
psql -h host -U username -p port -d database -L ~/file_to_save_output.txt > output.txt
From Postgres Doc
--echo-queries
Copy all SQL commands sent to the server to standard output as well.
This is equivalent to setting the variable ECHO to queries.
So in order to get query + query results to a single file,
psql -h host -U username -p port -d database --echo-queries -L output_queries_and_results.txt
Additionally you can save queries and query results in separate files,
psql -h host -U username -p port -d database --echo-queries -L output_queries_only.txt -o output_results_only.txt
Note: The first method will still show queries and query results in terminal, the second will output all results to the file and won't show in the terminal.

How to connect to redistogo? How to see the data?

Read through https://redistogo.com/documentation/introduction_to_redis?language=en but couldn't get it to work.
redis-cli -h my-host -p 1234 -a mypassword
What is my-host?
How to see the database?
The web console seems to not display all the data. keys fails.
redis-cli -h returns "Could not connect to Redis"
On https://redistogo.com/heroku/resources/934839 where your app installs redistogo.
The following link is given:-
redis://redistogo:12340994131cb8c2f2402ffdsafds3333129#birdeye.redistogo.com:3244/
using this you type on console:-
redis-cli -h my-host -p 1234 -a mypassword
redis-cli -h birdeye.redistogo.com -p 3244 -a 12340994131cb8c2f2402ffdsafds3333129
and you will log onto console.
"My-host" is the hostname you get from Redis To Go.

MySQLDump to local machine from remote server connected via SSH

mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename > C:\path\to\store\file
It seemed to work as it paused while the file was downloading, however no file appears once it completes.
Do I have something wrong in the command line?
Use like this:
mysqldump -P3306 -h192.168.20.151 -u root -p database > c:/my.sql
Hope to help you:)
Edition for linux
mysqldump -u root -p databasename > ~/Downlaods/filename.sql
Simply run mysqldump -h xxx.xxx.xxx.xxx -u username -ppassword databasename > C:\path\to\store\file from the command prompt on your local machine.
I don't understand why you involve ssh in your question but...
First try the same command without redirecting it to a file to see that you can connect to the database.
Second make sure that you can write to that location (try to create and edit a file in the same path).
If those to work your command should work.