๐Ÿ‘ฉ๐Ÿผโ€๐Ÿ’ป tech-note

How to update any cells in MySQL?

I forgot about it so, so frequently that I decided to jot down the syntax. For example, to make all the posts unpublished in Ghost: update

I forgot about it so, so frequently that I decided to jot down the syntax.

For example, to make all the posts unpublished in Ghost:

update posts set status = "draft";

Or if you want to add the condition:

update posts set status = "draft" where author_id = "1";

Source: https://stackoverflow.com/a/3024567/2360798

-->
1 min read
๐Ÿ‘ฉ๐Ÿผโ€๐Ÿ’ป tech-note

How to drop all tables in MySQL?

It is simple enough if you don't care about permissions, etc..., which is true of my local test database. mysql -uUSER -p -e "drop dat

It is simple enough if you don't care about permissions, etc..., which is true of my local test database.

mysql -uUSER -p -e "drop database YOUR_DB;"
mysql -uUSER -p -e "create database YOUR_DB;"
mysql -uUSER -p YOUR_DB < SQL_FILE.sql

And now you get a refreshed DB.


If you don't mind getting

-->
1 min read
๐Ÿ‘ฉ๐Ÿผโ€๐Ÿ’ป tech-note

How to backup MySQL database on Compute Engine?

If you are looking for how to backup your MySQL database that is hosted over a cloud instance, it shall be better to use Cloud SQL or someth

If you are looking for how to backup your MySQL database that is hosted over a cloud instance, it shall be better to use Cloud SQL or something others that cloud providers offer, as they take care of replication, backup, patches and updates, etc...

However, it is a bit expensive IMHO, so let's backup your database manually on the instance.

-->
1 min read