Problem
You want to reset the root password for MySQL in your linux Ubuntu installation.
Solution
Follow the steps described https://linuxconfig.org/how-to-reset-root-mysql-password-on-ubuntu-18-04-bionic-beaver-linux
You want to reset the root password for MySQL in your linux Ubuntu installation.
Follow the steps described https://linuxconfig.org/how-to-reset-root-mysql-password-on-ubuntu-18-04-bionic-beaver-linux
Problem
You would like to be able to automatically send some emails (ie reports) from a linux server, using a bash script that runs in cronjob, without installing an email server on the linux server.
Solution
#!/bin/bash
# Email setup
SENDGRID_API_KEY="your_sendgrid_api_key"
FILENAME_ATTACH="title_of_your_attachment"
FILENAME_ZIP="the_path_to_your_zip_file"
FILENAME_BASE64_TMP="the_path_to_temporary_base64_encoding"
EMAIL_TO="email_to_address"
EMAIL_SUBJECT="email_subject"
EMAIL_FROM="email_from_address"
EMAIL_MESSAGE="your_email_message"
function email_exports()
{
FILENAME_BASE64=$(base64 -w0 $FILENAME_ZIP);
REQUEST_DATA='{"personalizations": [{
"to": [{ "email": "'"$EMAIL_TO"'" }],
"subject": "'"$EMAIL_SUBJECT"'"
}],
"from": {
"email": "'"$EMAIL_FROM"'"
},
"content": [{
"type": "text/plain",
"value": "'"$EMAIL_MESSAGE"'"
}],
"attachments": [{
"content": "'"$FILENAME_BASE64"'",
"filename": "'"$FILENAME_ATTACH"'"
}]
}';
# We need to store the base64 locally as the text
# is too big for sending directly with curl
echo $REQUEST_DATA > $FILENAME_BASE64_TMP
curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \
-H "Authorization: Bearer $SENDGRID_API_KEY" \
-H "Content-Type: application/json" \
-d "@$FILENAME_BASE64_TMP";
rm $FILENAME_BASE64_TMP
}
email_exports
Problem
You would like to access a host set up with nginx after adding your own vhost configuration file in /etc/nginx/conf.d/myfile.smth, but you get Connection refused.
Solution
Make sure that your nginx configuration file has the .conf extension as /etc/nginx/conf.d/myfile.conf.
Problem
You have a folder with many gzipped files that you want to unzip at the same time.
Solutionls -al | grep gz | awk ‘{ print $9}’ | xargs gunzip
Problem
You are trying to use docker-compose to get some services up with docker but you see an error like the following:
Cannot create container for service xxx: invalid mode: /path/to/volume/
Solution
This is more than likely caused by a typo in your yml file, so go back and check carefully for any typos and correct them.
Problem
Using docker-compose up (or build), displays the following error message (even though the same command used to work previously):
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
Solution
This is quite possible caused by permissions issue, as one of the folders files that docker is trying to use is owned by a different user/group from the one trying to use the docker-compose commands. Try to find the file/folder with the different permissions and change it to your user name and group, or use change the files by using something like:
chown -R me:me .
Problem
You are trying to run the ps command in a docker container (ie ps ax), but you get:
bash: ps: command not found
Solutionapt install procps
Taken from the answer here
Problem
You have a MySQL table that does not have any timestamp information (creating, updating) and you want to add a column that automatically adds a timestamp every time the record is created.
Solution
Add the column for timestamp that creates a timestamp every time a new record is created (INSERT) by using the following:
ALTER TABLE table_name ADD created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
More information here
Problem
You would like to know the IP Address of a running Docker container.
Solution
Use the following to find out the IP Address by replacing the container_name with the actual container name:
docker inspect -f '{{ .NetworkSettings.IPAddress }}' container_name
Trying to set up minikube you get the following error:
Error setting up kubeconfig: writing kubeconfig: Error writing file : open : no such file or directory
Unset the KUBECONFIG to solve the issue (unset KUBECONFIG) as described https://pubci.com/2017/01/01/why-not-tryout-kubernetes-locally-via-minikube/