MySQL

Create a slug from a name in MySQL/MariaDB

August 25, 2023

How to create a slug from the name of an item in MySQL/MariaDB.


Read More

How to Change a MariaDB/MySQL Data Directory to a New Location on Linux

March 7, 2023

Step 1 — Moving the MariaDB Data Directory mysql -u root -p select @@datadir; Output: +-----------------+ | @@datadir | +-----------------+ | /var/lib/mysql/ | +-----------------+ 1 row in set (0.


Read More

How to count the amount of rows in MariaDB fast

February 11, 2023

If you need to find the fastest way to count the number of rows in a massive MariaDB, or MySQL table, then you can do the following instead of performing a select count() query:


Read More

How to Join Multiple MySQL Tables in Python

August 9, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Limit a MySQL Query in Python

August 8, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Update a MySQL Table in Python

August 7, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Drop a MySQL Table in Python

August 6, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Delete MySQL Records in Python

August 5, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to ORDER BY a MySQL Query in Python

August 4, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Filter WHERE MySQL Queries in Python

August 3, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Select From MySQL in Python

August 2, 2022

First, you will need the mysql.connector. If you are unsure of how to get this setup, refer to How to Install MySQL Driver in Python .


Read More

How to Insert into a MySQL Table in Python

August 1, 2022

If you need to insert data into a MySQL table using Python, then look no further.


Read More

How to Create a Primary Key for a MySQL Database in Python

July 31, 2022

You can create a Primary Key for your MySQL database in Python as follows.


Read More

How to Create a MySQL Table in Python

July 30, 2022

If you need to create a table in a MySQL database using Python, then you can do the following.


Read More

How to Create a MySQL Database in Python

July 29, 2022

In order to create a MySQL database in Python, you first need to initiate a connection using the mysql.


Read More

How to Install MySQL Driver in Python

July 28, 2022

To begin using MySQL in Python, you need to do the following:


Read More

How to move MySQL database to another drive

March 10, 2022

Step 1: Login to your MySQL server, enter your password when prompted:


Read More

[Solved] ERROR 1030 (HY000): Got error 168 from storage engine

September 8, 2021

If you are getting the following error in MySQL: ERROR 1030 (HY000): Got error 168 from storage engine


Read More

How to clone a table structure in MySQL

April 27, 2021

I have often needed to clone a table without it’s data in MySQL.


Read More

pt-online-schema-change Add Index

March 19, 2021

Percona has a great toolkit that allows you to perform schema changes on a MySQL or MariaDB database without any downtime, it works by creating a new table with the same schema, making the changes to it and applying triggers for insertion, deletion and all updates, all while performing your valuable schema updates for you!


Read More

How To Create a User and Grant Permissions in MySQL

September 1, 2020

How to create a user CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; How to delete a user DROP USER 'myuser'@'localhost'; How to grant permissions GRANT ALL PRIVILEGES ON * .


Read More

Faster alternative to MySQL Delete Table Contents / Truncate

June 13, 2020

From time to time you might have some rather big tables that you want to delete all the data quickly and start afresh.


Read More

Moving a MySQL Database without downtime

May 21, 2020

At Statvoo Analytics we found ourselves in the position where we needed to move our master MySQL database without ANY downtime and for anyone who’s tried to do this, you will know how hard this can be if it is not done exactly right.


Read More

ORDER BY RAND() – Faster Alternative

May 10, 2020

MySQL’s ORDER BY RAND() function can be so useful for returning random items from a table, in fact, we have used it a million times over the years.


Read More

How to Bring Back GROUP BY in MySQL

March 31, 2020

If you are suddenly not able to perform GROUP BY statements as you used to after a MySQL/MariaDB version update, then you will have noticed the change forced upon you.


Read More

How to Purge the BinLog for MySQL and MariaDB

March 27, 2020

If you see lots of disk space quickly disappearing on your MySQL or MariaDB server, then you may want to look into the BinLog directory, it is located at /var/log/mysql/.


Read More

How to Delete from a Table where rows match in Another Table – MySQL

March 24, 2020

So you have a table where you want to delete a bunch of rows, based on a particular column being matched in another table.


Read More

REPLACE INTO instead of INSERT INTO – MySQL

March 23, 2020

There are many occasions where you need to INSERT a record into a MySQL database table, but the record already exists.


Read More

When to use FLUSH PRIVILEGES in MySQL

December 6, 2017

So if you’ve ever created users and given them specific permissions from with SQL or the commandline, you will be familiar with a statement called FLUSH PRIVILEGES.


Read More

MySQL Community Server MSI Installer Hangs on Windows 10

December 6, 2017

I was trying to install MySQL Community Server for Windows 10 using the standard .


Read More

Let Joomla and MySQL interact!

December 21, 2012

I often need a quick and easy few lines to retrieve some data from MySQL using Joomla without all the MVC nonsense that usually goes about this topic.


Read More

How to backup all mysql databases

April 26, 2012

In order to backup all mysql databases, you can run the following command in your linux command line:


Read More

Unable to connect to any of the specified MySQL hosts.

February 19, 2012

If you get the following error while trying to connect to a MySQL database using a third party client such as TOAD or SQL Workbench, then you need to edit your mysql server’s my.


Read More

LEN in MySQL

February 1, 2012

In MySQL 5.1 LEN is called LENGTH, you use it exactly the same and pass in the link, so: LENGTH(link).


Read More

MySQL Error: Can’t get hostname for your address

December 14, 2011

This error is thrown by MySQL because it tries to do a DNS lookup on the address connecting to the server and it fails due to the IP not being able to be resolved back to a name or some-other deeper DNS bust problem.


Read More

..near 'option o ON (po.option_id = o.option_id) LEFT JOIN option_description od ON (o.o' at line 1

May 9, 2011

So you’ve just installed Opencart 1.5.0 and when attempting to edit a product or category or etc you get the following error:


Read More

MSSQL Select Not Null

September 2, 2010

I mainly use MySQL these days, so get screwed over for a few minutes when I have to do something in MSSQL that is slightly different when it comes to it’s custom syntax.


Read More

MySQL Main Query Types used in PHP to select, insert, update and delete data

April 16, 2010

MySQL Main Query Types SELECT SELECT * FROM tablename INSERT INSERT INTO tablename (col1, col2, col3,.


Read More

Connect to mysql database from php

April 16, 2010

If you need to connect to a mysql database from php you can do it like this:


Read More

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource

February 2, 2010

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource


Read More

mySQL select multiple ids

December 18, 2009

SELECT * FROM tablename WHERE `active`='1' AND `id` IN ('107' , '125' ) ORDER BY `id` DESC LIMIT 12`


Read More