Category: MySQL

Connect WordPress to Custom MySQL with Azure VM

The title is a bit of a mouthful, but I promise it’s not as crazy as it seems. If you’re anything like me, you became interested in cloud computing and stumbled upon Microsoft’s Azure platform. There are plenty of wizards built directly in to the Azure Dashboard which allow you to automatically create and setup websites, virtual machines, and databases without ever needing to perform extra configuration. However, there are some cases where you might want to setup a custom database for a specific purpose. WordPress is one great example which may require you to setup your own MySQL databases in a virtual machine. In fact, this guide assumes that you already have a WordPress Azure Website setup.
Read more

Using SQL to insert all rows from a select

Inserting all rows from a select statement is a fairly common operation. You may be transferring the contents of one table to another or performing a complex multi-joined select and moving those values to another temporary table. The basic statement goes something like this:

INSERT INTO table1 (column1)
FROM table2

You can modify this for your specific purposes like so:

INSERT INTO AccessLog (UserId, PageId, AccessTime)
SELECT UserId, 5, now()
FROM Users
Read more