Showing entries 171 to 180 of 980
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: database (reset)
MySQL EXTRACT() method for specific DATE and TIME values

Date and time values are some of the most important datatypes in an RDBMS. From tracking order dates to payroll hours, DATE and DATETIME datatypes are used in all types of applications. At times as a Developer, you may need only certain portions of a DATE or DATETIME value. In MySQL, the EXTRACT() function can provide you with a specific component of a DATE or DATETIME value depending on which INTERVAL is given as a parameter. Continue reading to see example EXTRACT() queries for understanding…

Photo by Omar Al-Ghossen on Unsplash

[Read more]
Dynamic MySQL CREATE TABLE statement with pandas and pyodbc

Have you ever had to type out a massive CREATE TABLE statement by hand? One with dozens of columns? Maybe several dozens of columns? There are likely some GUI tools to help with large CREATE TABLE commands. Or, other drag-n-drop types of software that I am not familiar with. What if you could write a few lines of Python code and take care of a huge CREATE TABLE statement with way less effort than typed manually? Interested? Continue reading and see how using pandas, pyodbc, and MySQL…

Photo by Vorsen Furniture on Unsplash

OS, Software, and DB used:

  • OpenSuse Leap 15.1
[Read more]
3 MySQL Commands Developers should know.

If you are a developer working in a MySQL environment, this blog post is for you. I share 3 MySQL commands or statements that you should know. That is a bold statement, I know. Turns out, once you do know (of) these commands, you will use them all the time. They minimize guesswork which leads to better productivity in other facets of your programming and querying workflow. I use them myself almost daily and am sure you will too once you see how simple they are to use. So why should you know them? Continue reading and find out…

Photo by hannah joshua on Unsplash

OS, Software, and DB used:

  • OpenSuse Leap 15.1
[Read more]
TRIM() string function in MySQL – with examples.

In this post, I’ll cover examples of the MySQL TRIM() function. TRIM() removes specific characters – or spaces – from a given string, at either: the beginning, ending, or potentially in both locations depending on several factors. With an optional keyword argument that controls which character(s) – if any – are removed, TRIM() can be tricky so let’s gain understanding with several easy-to-digest examples…

Photo by Peter Beukema on Unsplash

OS, Software, and DB used:

  • OpenSuse Leap 15.1
  • MySQL 8.0.20

Self-Promotion:

If you enjoy …

[Read more]
Sorting associative arrays in PHP with array_multisort() – New learning

If you write MySQL queries, at some point you are going to have to provide query results in a specific order. To impose any ordering in MySQL (this applies to SQL overall and is not directed only at MySQL), you have to use the ORDER BY clause. Without it, there is no guaranteed order. The database is free to send back query results in any order. As I learn PHP, I make it a point to explore both the MySQL side, along with the PHP side in regards to similar type tasks and the efficiency of each. So far in my PHP journey, I have found that arrays are used quite extensively. In this post, I’ll cover array_multisort() – one of many in-built PHP functions – used for sorting arrays. In the context of the example data for this post, the arrays are populated by an unordered MySQL query. Let’s see one example of how you can establish a sorting order in a PHP …

[Read more]
Join ProxySQL Tech Talks with Percona on June 4th, 2020!

Long months of the pandemic lockdown have brought to life many great online events enabling the MySQL community to get together and stay informed about the very recent developments and innovations available to MySQL users. It isn’t over yet! Next Thursday, June 4th, Percona & ProxySQL are co-hosting the ProxySQL Tech Talks with Percona virtual meetup covering ProxySQL, MySQL and Percona XtraDB Cluster.

The attendees are invited to participate in the two-hour deep-dive event with plenty of time for questions and answers (we will have two 40-minute sessions + 20 minutes allocated for Q&A). Get prepared, come with your burning questions and true war stories – we’ll have our speakers answer and comment on them! And here come the speakers:

  • René Cannaò, ProxySQL author and CEO of ProxySQL …
[Read more]
Exploring MySQL Binlog Server – Ripple

MySQL does not limit the number of slaves that you can connect to the master server in a replication topology. However, as the number of slaves increases, they will have a toll on the master resources because the binary logs will need to be served to different slaves working at different speeds. If the data churn on the master is high, the serving of binary logs alone could saturate the network interface of the master.

A classic solution for this problem is to deploy a binlog server – an intermediate proxy server that sits between the master and its slaves. The binlog server is set up as a slave to the master, and in turn, acts as a master to the original set of slaves. It receives binary log events from the master, does not apply these events, but serves them to all the other slaves. This way, the load on the master is tremendously reduced, and at the same time, the binlog server serves …

[Read more]
Export MySQL query results as JSON

In one of the latest post, I discussed how to transform a large MySQL table to JSON using Apache Spark. Well, that approach works for any tables with any volume. But it’s an overkill for simple and small tables. The good news is MySQL by default has a feature for …

The post Export MySQL query results as JSON appeared first on Geeky Hacker.

Finding the Unknowns in Database Audit Logs

Then secretary of Defense Donald Rumsfeld popularized the terms: “known knowns”, “known unknowns”, and “unknown unknowns.” With the ever-increasing number of data breaches and vulnerabilities, database operation teams have to account for every possibility. Visualizing your audit data allows you to look for the “unknowns”, those access patterns or connections that you’d otherwise overlook.

Although enabling an audit log and shipping it off to a vault may meet security and regulatory requirements, you will lose an important opportunity to protect your customer and employee information.

The following dashboard demonstrates the type of information that audit logs can reveal:

  • Who is connecting to my database (IP address, location, username..)
  • Who is trying to connect to my database but getting access errors?
  • Which tables are being accessed and by whom?
[Read more]
MySQL SSL Enable Replication

This blog post illustrates ” How to setup SSL enabled replication”

By default, mysql package installation creates SSL file in the data directory at the time of installation. If you would like to use different self-signed certificates then create them as described here.

Add SSL setting to my.cnf on all servers.


ssl=on
ssl-ca=/etc/sslcerts/ca.pem
ssl-cert=/etc/sslcerts/server-cert.pem
ssl-key=/etc/sslcerts/server-key.pem

Restart mysql server and verify the settings.

Example: client connections using SSL


#mysql -urpluser -p -P22403 --host 127.0.0.1 --ssl-cert=/etc/sslcerts/client-cert.pem --ssl-key=/etc/sslcerts/client-key.pem -e '\s'
Enter password:
--------------

Connection id: 5
Current database:
Current user: rpluser@localhost
SSL: Cipher in use is DHE-RSA-AES256-SHA
Current …
[Read more]
Showing entries 171 to 180 of 980
« 10 Newer Entries | 10 Older Entries »