Showing entries 5016 to 5025 of 44041
« 10 Newer Entries | 10 Older Entries »
When MySQL Goes Away

Handling MySQL errors in Go is not easy. There are a lot of MySQL server error codes, and the Go MySQL driver as its own errors, and Go database/sql has its own errors, and errors can bubble up from other packages, like net.OpError. Consequently, Go programs tend not to handle errors. Instead, they simply report errors: err := db.Query(...).Scan(&v) if err != nil { return err } And then the error is logged or reported somewhere.

When MySQL Goes Away

Handling MySQL errors in Go is not easy. There are a lot of MySQL server error codes, and the Go MySQL driver as its own errors, and Go database/sql has its own errors, and errors can bubble up from other packages, like net.OpError. Consequently, Go programs tend not to handle errors. Instead, they simply report errors:

err := db.Query(...).Scan(&v)
if err != nil {
 return err
}

And then the error is logged or reported somewhere. This is as poor as it common, and it’s extremely common. A robust program handles the error: retry the query if possible; or report a more specific error; else, report the …

[Read more]
When MySQL Goes Away

Handling MySQL errors in Go is not easy. There are a lot of MySQL server error codes, and the Go MySQL driver as its own errors, and Go database/sql has its own errors, and errors can bubble up from other packages, like net.OpError. Consequently, Go programs tend not to handle errors. Instead, they simply report errors: err := db.Query(...).Scan(&v) if err != nil { return err } And then the error is logged or reported somewhere.

Auditing MariaDB for Secured Database Infrastructure Operations

When you are building Database Infrastructure for an data sensitive business (like financial services, digital commerce, advertising media solutions, healthcare etc. ) governed by compliance and policies, You are expected to maintain the audit log of the transactions to investigate, if you ever suspect something unacceptable (i.e., user updating / deleting data) happening to your database . MariaDB provides Audit Plugin (MariaDB started including by default the Audit Plugin from versions 10.0.10 and 5.5.37, and it can be installed in any version from MariaDB 5.5.20.) to log the server activity, Although the MariaDB Audit Plugin has some unique features available only for MariaDB, it can be used also with MySQL. MariaDB Audit Plugin log the details like who connected to server (i.e., username and host), what queries were executed, the tables accessed and server variables changed. This information is retained in a rotating log file or sent to …

[Read more]
Comment on Backing up users and privileges in MySQL by Kjeld Flarup

Found out that from MySql version 5.7 show grants nolonger exports passwords. Now there is a show create user.

LikeLike

MySQL Router HA with Keepalived

After having explained how to achieve HA for MySQL Router for people who doesn’t want to install the MySQL Router on the application servers and after having illustrated how to use Pacemaker, this article explains how to setup HA for MySQL Router using keepalived.

Keepalived is very popular, maybe because it’s also very easy to use. We can of course use 2 or more servers. The principle is the same as on the previous articles, if the router dies, the virtual IP used by the application server(s) to connect to MySQL is sent to another machine where mysqlrouter is still running.

Let’s have a look at the configuration, in this case we use 2 machines, mysql1 and …

[Read more]
MySQL Router HA with Pacemaker

This article will explain how to setup HA for MySQL Router as described in a previous article about where should the router stand.

For this setup, I will use Pacemaker (part of RedHat High Availability Add-on and available on RHEL, CentOS, Oracle Linux, …).

Of course we need a MySQL InnoDB Cluster but we won’t really use it for the HA setup of the MySQL Router.

Installing Pacemaker

The first step is to install pacemaker on all the machines we will use for our “MySQL Router Cluster”:

# yum install pacemaker pcs resource-agents

Now we need to start the pcsd service and enable it at boot (on all machines):

# systemctl start pcsd.service 
# systemctl enable pcsd.service

It’s time now to setup authentication, this operation is again …

[Read more]
MySQL InnoDB Cluster: is the router a single point of failure ?

As you know, MySQL InnoDB Cluster is composed of 3 elements:

  • a group replication cluster of at least 3 servers
  • the MySQL Shell used to manage the cluster
  • the MySQL Router that send the traffic from the application server(s) to the cluster

When presenting the solution in conferences, one the main question is Where should I put the router ? and the answer is always the same: the best place to install the router is the application server !

The router is a very lightweight process that gets its configuration from the cluster’s metadata and doesn’t require a lot of resources or maintenance.

So the ideal setup is the following:

However for many (obscure?) reasons, sometimes people doesn’t want to have the MySQL …

[Read more]
Comment on Backing up users and privileges in MySQL by Kjeld Flarup

My output of pt-show-grants –drop is

DROP USER ‘kjeld’@’localhost’;
DELETE FROM `mysql`.`user` WHERE `User`=’kjeld’ AND `Host`=’localhost’;
— Grants for ‘kjeld’@’localhost’
GRANT ALL PRIVILEGES ON *.* TO ‘kjeld’@’localhost’ WITH GRANT OPTION;

There is no statement like this:
CREATE USER IF NOT EXISTS ‘check’@’%’;
ALTER USER ‘check’@’%’ IDENTIFIED WITH ‘mysql_native_password’ AS ‘*B865CAE8F340F6CE1485A06F4492BB49718DF’ REQUIRE NONE PASSWORD EXPIRE

LikeLike

How To Convert MySQL Two Digit Year To Four Digit Year

create table csv_date (date varchar(20)); insert into csv_date values ('2030-05-18 14:57:19'); insert into csv_date values ('2030-05-18 14:55:15'); insert into csv_date values ('2019-05-18 04:15:15'); insert into csv_date values ('2018-05-18 02:11:53'); insert into csv_date values ('2017-05-18 22:14:24'); Convert two digit to four digit in MySQL: Create a temporary table same as the original table but make the column …

The post How To Convert MySQL Two Digit Year To Four Digit Year appeared first on SQLgossip.

Showing entries 5016 to 5025 of 44041
« 10 Newer Entries | 10 Older Entries »