Excel and MySQL can read and write delimited text (CSV) files. To load a text file into MySQL, use the LOAD DATA INFILE statement. To create a text file from MySQL, use the SELECT INTO OUTFILE syntax, or the ability of the client to write or redirect to a file. For example: $ mysql -e […]
mysql
How to use mysqldump without CREATE TABLE statements
mysqldump is a utility program used for making a logical backup by generating a set of SQL statements that can be executed to reproduce the original database table data and object definition. It dumps one or more database for backup or may transfer to another SQL server. It can also generate data output in different […]
How to Use External Python modules in MySQL Shell
MySQL Shell is a great tool for working with MySQL. One of the features that make it stand out compared to the traditional mysql command-line client is the support for JavaScript and Python in addition to SQL statements. This allows you to write code you otherwise would have had to write outside the client. This […]
Configure MySQL Router to Auto Restart of Failure using systemd
The systemd unit file that ships with the MySQL Router 8.0 RPM’s will not automatically restart mysqlrouter on failure. It can be modifed to do so, though, by editing the file /usr/lib/systemd/system/mysqlrouter.service and adding this line: Restart=on-failure Put it right after the “ExecStart” line, so that the file ooks like this: [Unit] Description=MySQL Router After=syslog.target […]
How to change the audit log path in the MySQL Docker
1. Here we use 5.7.29 Docker image as an example. $ docker load -i mysql-enterprise-server-5.7.29.tar 2. You can bind OS mounts to Docker directory, assume you want to keep the audit logs under /bak/logs directory on the host. $ docker run –name=mysql1 \ –mount type=bind,src=/bak/my.cnf,dst=/etc/my.cnf \ –mount type=bind,src=/bak/data,dst=/var/lib/mysql \ –mount type=bind,src=/bak/logs,dst=/var/lib/logs \ -d mysql/enterprise-server:5.7 3. […]
How to use mysqlsh to execute addInstance in silent mode
Question: How to use mysqlsh to execute addInstance in silent mode (from a script) and avoid answering such a question? cl.addInstance(‘[USER]@[HOST]:[PORT]’) Please pick an option out of [C]lone/[I]ncremental recover/[A]bort (default Clone): Adding an instance to InnoDB Cluster requires the specification of what kind of recovery is desired. This can be of two types (incremental or […]
How to take Logical Backups on a MySQL Replication Slave using shell script
The sample script in this post uses the bash shell. It is also assumed that MySQL has been installed and the slave has been initialized. For MySQL 5.7 and later, the script only works for single-source replication. The server to be backed up should be configured as a slave. If you have one or more […]
MySQL Cluster requirements to avoid Single Point of Failure
In this post, we will discuss the minimum requirements to have no single point of failure for all services in a MySQL Cluster setup. To remove all single points of failure there are the following requirements to the Cluster configuration: There must be two copies of the data To allow API and data nodes to […]
What is an Arbitrator in MySQL Cluster
If one or more nodes in a cluster fail, it is possible that not all cluster nodes will not be able to “see” one another. In fact, it is possible that two sets of nodes might become isolated from one another in a network partitioning, also known as a “split brain” scenario. This type of […]
How To Install MySQL RPM packages in a different location to allow multiple versions (versions < 5.6.10)
Question: How to install the MySQL RPM packages in a different location to allow multiple versions and/or avoid compromising your existing installation? Note that it is generally not recommended to install the RPM package of MySQL in a different location. Install the RPM package(s) You can use the –relocate option for the rpm command to […]