Don't add command to MySQL CLI history - mysql

One can instruct Bash not to add a command to the CLI history by prepending the command with a space. How can one instruct the MySQL CLI interpreter to not add a command to the history? Prepending the command with a space does not have the desired effect.

You can run mysql with the -q option to skip use of the history file.

Related

I don't know why the qemu-system error occurs

Why does an error appear as shown in the picture?
Is the command wrong?
Before entering that command, I entered the following:
apt-get update -y
Download vmlinux-3.2.0-4-4kc-malta or debian_wheez_mips_standard_qcow2 using wget command
The -redir option was removed in QEMU 3.1: https://www.qemu.org/docs/master/about/removed-features.html#redir-removed-in-3-1
You need to update the command line to use the newer syntax instead.

How to set input from bash script in an interactive shell?

So when I install percona mysql, I get the following.
I am trying to automate sql installation using a bash script but how do I enter into the input using bash script? Enter something > hit enter.
The preferred way of achieving this is using unattended mode by setting the following environment variable before calling apt install:
export DEBIAN_FRONTEND=noninteractive
This will not prompt the user for any input but instead use the default values for everything.
If you want to supply an answer to a configuration question different to the default value, use preseeding DebConf.

mysqldump not found (Wordmove). How to correctly set up a symlink in Zsh?

I have searched through related questions but have still not found an answer to this one.
I am using Wordmove to try and push/pull databases between local and live environments for WordPress (running on AMPPS on OSX). I have come back to trying the Wordmove method since the fork of WP-Sync-DB stopped working for me and appears to be abandoned now. This was the best free method for migrating databases between WordPress environments.
The error I am getting when running wordmove pull -e runcloud --db is sh: mysqldump: command not found
I am using Zsh and have already added a symlink to the only mysqldump I could locate on my system: alias mysqldump='/Applications/AMPPS/mysql/bin/mysqldump --host=localhost -uroot -proot' in .zprofile . It is also included in my .bash_profile . Without that line I simply get mysqldump not found (verified by commenting the line and needing to restart iTerm after each change).
So now if I type which mysqldump I get mysqldump: aliased to /Applications/AMPPS/mysql/bin/mysqldump --host=localhost -uroot -proot
But the error from Wordmove persists. I have enquired on the Wordmove Github and the author says this will be an error with how mysqldump if configured.
Disclaimer: I am not at all expert with CLI, only knowing enough to configure an environment for Gulp, using tools like Wordmove and basic stuff over SSH. I chose Zsh as it made a lot of stuff easier to use and to see, but any kind of configuration for this usually has me scratching my head!
Have I missed something obvious here? Perhaps the symlink is not set up correctly?
I see two conceptual problems here:
(1) You can not export an alias. An alias defined in the current Zsh, won't be automtaically be visible in a child Zsh.
(2) Your error message says
sh: mysqldump: command not found
which means that Zsh is not even involved when looking for mysqldump. This is a Posix shell script running.
Hence, every mechanism you want to use must work with Posix shell, which means that you need a program (a suitable shell script) named mysqldump in your PATH, which then calls the original mysqldump with the parameters you have in mind.
Make sure that the PATH is set up so that your private version of mysqldump is found before the one in /Applications/AMPPS/mysql/bin.

git log --pretty=format windows strange behavior

I reduce the problem to its lowest terms.
Under linux a git command like this:
git log --pretty=format:{"commit":"%H"}
gives me a valid json element, so something like:
{"commit":"20cafdecc9898113ac6215ae70cd7622dc2cae3b"}
under windows I obtain a not-valid json element, because in some way windows seems to remove the double-quotes elements and I obtain:
{commit:20cafdecc9898113ac6215ae70cd7622dc2cae3b}
Do you know why, or how can I fix it making it work under both os?
Thank you!
I assume that your shell on Linux is NOT a bash shell because my bash shell on Linux gives me the same output as on Windows - without double-quotes.
The doubles-quotes are special characters for most shells - so you have to protect them either by "escaping" or by "quoting".
git log --pretty=format:{\"commit\":\"%H\"}
git log --pretty='format:{"commit":"%H"}'
This works for bash on Linux and bash on Windows. I have not tested it with cmd on Windows.

Mysql on the command line (can't use all keyboard buttons)

Using mysql directly from the command line (running on Ubuntu 9.10, standard bash terminal), I am unable to use certain keyboard buttons like:
Delete, Control-(arrow right), Control-(arrow left)
Which gets returned to me as:
~;5C;5D
respectively. I'm assuming there must be a flag in mysql that fixes this but I have been unable to find one. Is there a .mysqlconfig file to edit to make this happen on startup?
According to this thread and mysql --version, mysql is compiled with editline instead of readline. From that thread:
I had to add create an .editrc file with the following lines to get ctrl-R and DELETE to work.
bind "\e[3~" ed-delete-next-char
bind "^R" em-inc-search-prev
Although that didn't work for me.
Another suggestion from that thread did work:
$ sudo apt-get install rlwrap
Then add an alias in ~/.bashrc
alias mysql='rlwrap -a mysql'
This problem may be specific to Ubuntu 9.10