Join us on OCT 13 or 15 for some of the best MySQL sessions from the most renown MySQL experts. This is your opportunity to discover the latest developments in MySQL 8.0 and learn about the new MySQL Database Service directly from the software engineering team. Get advice from experienced developers...
All over the Internet people are having trouble getting
LOAD DATA and LOAD DATA LOCAL to work.
Frankly, do not use them, and especially not the
LOCAL variant. They are insecure, and even if you
get them to work, they are limited and unlikely to do what you
want. Write a small data load program as shown below.
Not using LOAD DATA LOCAL
The LOCAL version of LOAD DATA has two potential security issues:
-
Because LOAD DATA LOCAL is an SQL statement, parsing occurs on the server side, and transfer of the file from the client host to the server host is initiated by the MySQL server, which tells the client the file named in the statement. In theory, a patched server could tell the client program to transfer a file of the …
I’ve been using MySQL 8 on Linux for a couple years but the Linux repository version didn’t install the new MySQL Shell. So, I discovered the new MySQL Shell when I installed MySQL 8 (8.0.21) on Windows to teach my student how to use it to learn SQL commands. I encourage you to read the full MySQL Shell document.
The following is a tutorial to provision a student
user and studentdb database in MySQL. It uses the
MySQL Shell (mysqlsh) and stages for uploads of
comma-separated values files.
After installing MySQL on the Windows 10 OS, open the Window OS Command Line Interface (CLI) shell by entering the following in the search field at the bottom left:
cmd
It launches a CLI interface to the Windows OS. The cmd (command) utility opens the CLI in the following …
[Read more]One of the key activities that a DBA does regularly is creating backup of an active database instance. So having a working backup tool in place especially for hot-backup is important when a user think of running DB-on-ARM. Even though Percona Xtrabackup (PXB) is not yet officially offered on ARM one can compile and successfully run it on ARM. This article will help explore the same.
Compiling
Percona-Xtrabackup is one of the most widely used open source tools for backing up MySQL Server (and its variants). It offers incremental/partial/full backup. The official packages for PXB are not yet available on ARM but we decided to give it a try by building it directly from the source.
Process is pretty easy and Percona documentation further simplifies it by making it a 3 steps process: …
[Read more]I’ve been using MySQL 8 on Linux for a couple years but the Linux repository version didn’t install the new MySQL Shell. So, I discovered the new MySQL Shell when I installed MySQL 8 (8.0.21) on Windows to teach my student how to use it to learn SQL commands. I encourage you to read the full MySQL Shell document.
The following is a tutorial to provision a student
user and studentdb database in MySQL. It uses the
MySQL Shell (mysqlsh) and stages for uploads of
comma-separated values files.
After installing MySQL on the Windows 10 OS, open the Window OS Command Line Interface (CLI) shell by entering the following in the search field at the bottom left:
cmd
It launches a CLI interface to the Windows OS. The cmd (command) utility opens the CLI in the following …
[Read more]
While preparing a set of student instructions to create a MySQL 8
(8.0.21) Windows 10 instance I found an error with
LOAD command and the --secure-file_priv
variable set in the my.ini file. After granting the
global FILE permission to the previously provisioned
student user:
GRANT FILE ON *.* TO 'student'@'localhost';
Any attempt to run the following command failed:
LOAD DATA INFILE 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\avenger.csv' INTO TABLE avenger FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\r\n';
and, raise this error message:
ERROR: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
The following covers my exploration to try and fix this error without removing a designated directory for secure file uploads. While MySQL 5.7 …
[Read more]We all like when error messages are descriptive and give a clear idea about what is happening; however, there are some cases when a few possible reasons lay behind one error message. “MySQL server has gone away” is one of them. Most of the cases when the error occurs are described in MySQL documentation, but it can get tricky. And here, I’d like to talk about “tricky”.
There are only a few major cases when this happens:
1. MySQL Thread Was Killed by an Administrator or a Utility Such as pt-kill
The manual intervention is likely to be intermittent and, as it is a one-time thing in certain situations (e.g., a bad long-running query), probably would be known to a DBA. Pt-kill might be less noticeable, as it is often left running as a workaround to prevent those bad long queries from taxing system resources. Checking the system …
[Read more]By Maksym Kryva.
If you don’t verify backups you may safely assume you don’t have them.
It often happens that MySQL backups can be invalid or broken due
to a software bug, or some hidden corruption. If you are lucky
enough, hours and days will be needed to resurrect a database
from a bad backup copy. If you ran out of luck quota, you may
lose a lot of data. Hence the importance of data backup
verification. Not many companies do backups, and even less verify
them. To make the verification problem easier, we have added a
verify command to the TwinDB Backup
Tool.
What the command does is that it takes a backup copy, restores it, prepares (applies redo logs, fixes permissions and so on) and runs a MySQL instance on it. Then it checks if the recovered database is healthy. You can …
[Read more]If you have a New Relic Infrastructure Pro license, and unmonitored MySQL servers, there’s now an easy solution at your fingertips. With the New Relic MySQL integration you can monitor and graph almost any detailed metric you could possibly want. New Relic recently unified its analytics tools with New Relic One, a dashboard that provides quick access to all the New Relic tools. With an Infrastructure Pro subscription, you get access to:
- New Relic Infrastructure: Flexible, dynamic monitoring of your entire infrastructure, from services running in the cloud or on dedicated hosts, to containers running in orchestrated environments.
- New Relic Alerts: A flexible, centralized notification system that unlocks the operational potential of New Relic. Alerts is a single tool to manage alert policies and alert conditions for all of your New Relic data. …
In Deleting data we have been looking at a process that loads data into MySQL, leveraging partitions to make it easier and faster to later get rid of the data again. For this, we created three processes, a data loader process, and two observers - one for creating partitions, and one for deleting them.
The observer processes have been running ANALYZE
TABLES and then polling
INFORMATION_SCHEMA.PARTITIONS every 1/10th of a
second to check if intervention is needed. They then have been
dynamically generating the necessary ALTER TABLE
statements maintaining the proper partitioning of the table by
adding and dropping additional partitions.
That is cumbersome and should not be necessary.
Using SQL to maintain partitions
It is possible to prepare and execute dynamic DDL in MySQL, using …
[Read more]