I was working in MySQL the other day and I came across a very cryptic error:
ERROR 1005 (HY000): Can't create table '#sql-4e5_13b5' (errno: 13)
After a little bit of investigation it turns out the MySQL system folder that holds the database file for the particular database I was working with was owned by another user than ‘mysql’. After a simple update of the owner of the containing folder, I restarted MySQL, and everything seemed to work fine. The command used was:
sudo chown -R mysql:mysql /var/lib/mysql/database_name/
The folder database_name contained the database files for the database I was working with, so recursively changing the owner to mysql fixed my problem. Hopefully it will save you a few minutes.
This is a pretty simple solution really. I was querying a mongo collection, and I was wanting to view said collection. However, the output in mongo CLI is less than desirable. After some digging, I found a simple way to print out the items in the collection in an easy to digest format.
Easy enough. This command will take the collection, and for each document in the collection, print it in a JSON format.