Showing entries 4276 to 4285 of 44147
« 10 Newer Entries | 10 Older Entries »
MySQL Tutorial: Create Database, Tables and Data Types

In this tutorial, you will learn about MySQL, how to create SQL databases, tables and various data types.

Prerequisites

You need to have MySQL server installed on your machine along with the MySQL client.

Create DATABASE | Create schema in MySQL

You can create a database in MySQL using the SQL instruction CREATE DATABASE .

Open a new terminal and invoke the mysql client using the following command: $ mysql -u root -p

Enter the password for your MySQL server when prompted.

You can now execute SQL statments. Let's see an example of creating a database named mydb: mysql> create database mydb;

Note: You can also use create schema for creating a database.

You can also add other parameters.

CREATE DATABASE IF NOT EXISTS

You can create multiple databases in your MySQL server. When using the IF NOT EXISTS parameter, you tell MySQL to create the …

[Read more]
MySQL InnoDB Cluster : avoid split-brain while forcing quorum

We saw yesterday that when an issue (like network splitting), it’s possible to remain with a partitioned cluster where none of the partition have quorum (majority of members). For more info read how to manage a split-brain situation.

If your read the previous article you notice the red warning about forcing the quorum. As an advice is never too much, let me write it down again here : “Be careful that the best practice is to shutdown the other nodes to avoid any kind of conflicts if they reappear during the process of forcing quorum“.

But if some network problem is happening it might not be possible to shutdown those other nodes. Would it be really bad ?

YES !

Split-Brain

Remember, we were in this situation:

We …

[Read more]
MySQL 8.0 Architecture and Enhancement Webinar: Q & A

In this blog, I will provide answers to the Q & A for the MySQL 8.0 Architecture and Enhancement webinar.

First, I want to thank everybody for attending my April 9, 2019, webinar. The recording and slides are available here. Below is the list of your questions that I was unable to answer fully during the webinar.

Q: What kind of Encryption levels does MySQL 8.0 provide?

The MySQL data-at-rest encryption feature supports the Advanced Encryption Standard (AES) block-based encryption algorithm and aes_256_cbc encryption algorithm for data at rest is hard coded.

Q: At what frequency does the redo log buffer flush the changes to disk? When is the commit variable set to zero?

Here’s an …

[Read more]
MYSQL8 and InnoDB Cluster

Some time ago, we decided to run KeyChest on a database cluster. Once we actually did it, I started doubting wisdom of this decision and it took a few months to get beyond the stability of a single-node MySQL database. I’ve written a blog post that the encryption should be just as simple as databases

The post MYSQL8 and InnoDB Cluster appeared first on Magic of Security.

MySQL InnoDB Cluster – HowTo #1 – Monitor your cluster

MySQL InnoDB Cluster - HowTo #1 - Monitor your cluster

Q: How do I monitor the status & the configuration of my cluster?

A: Use status() or status({extended:true}) or status({queryMembers:true})?

MySQL InnoDB Cluster – how to manage a split-brain situation

Everywhere I go to present MySQL InnoDB Cluster, during the demo of creating a cluster, many people doesn’t understand why when I’ve 2 members, my cluster is not yet tolerant to any failure.

Indeed when you create a MySQL InnoDB Cluster, as soon as you have added your second instance, you can see in the status:

    "status": "OK_NO_TOLERANCE",      
"statusText": "Cluster is NOT tolerant to any failures.",

Quorum

Why is that ? It’s because, to be part of primary partition (the partition that holds the service, the one having a Primary-Master in Single Primary Mode, the default mode), your partition must reach the majority of nodes (quorum). In MySQL InnoDB Cluster (and many other cluster solutions), to achieve quorum, the amount of members in a partition must be > (bigger) than 50%.

So when we have 2 nodes, if there is a network issue between the …

[Read more]
SQL Where Clause Example | SQL Where Query Tutorial

SQL Where Clause Example | SQL Where Query Tutorial is today’s topic. The WHERE clause is used to filter the database records. The WHERE clause is used to extract only those records that fulfill the specified condition. The SQL WHERE clause is used to specify the condition while fetching the data from a single table or by joining the multiple tables. If a given condition is satisfied, then only it returns the specific value from the table. You should use a WHERE clause to filter the records and fetching the necessary records.

SQL Where Clause Example

The WHERE clause is not only used in the SELECT statement; it is also used in an UPDATE, DELETE statement. The syntax of a SELECT statement with a WHERE clause is following.

SELECT column1, column2, columnN 
FROM table_name
WHERE [condition]

“SELECT column1, column2, column3 FROM tableName” is the standard …

[Read more]
How to Add More Nodes to an Existing ProxySQL Cluster

In my previous post, some time ago, I wrote about the new cluster feature of ProxySQL. For that post, we were working with three nodes, now we’ll work with even more! If you’ve installed one ProxySQL per application instance and would like to work up to more, then this post is for you. If this is new to you, though, read my earlier post first for more context.

Check the image below to understand the structure of “one ProxySQL per application”. This means you have ProxySQL installed, and your application (Java, PHP, Apache server etc) in the same VM (virtual machine).

Having taken a look at that you probably have a few questions, such as:

  • What happens if you have 20 nodes …
[Read more]
Removal of implicit and explicit sorting for GROUP BY

In MySQL, historically GROUP BY was used to provide sorting as well. If a query specified GROUP BY, the result was sorted as if ORDER BY was present in the query.

mysql-5.7> CREATE TABLE t (id INTEGER,  cnt INTEGER);
Query OK, 0 rows affected (0.03 sec)

mysql-5.7> INSERT INTO t VALUES (4,1),(3,2),(1,4),(2,2),(1,1),(1,5),(2,6),(2,1),(1,3),(3,4),(4,5),(3,6);
Query OK, 12 rows affected (0.02 sec)
Records: 12  Duplicates: 0  Warnings: 0

mysql-5.7> SELECT id, SUM(cnt) FROM t GROUP BY id;
+------+----------+
| id   | SUM(cnt) |
+------+----------+
|    1 |       13 |
|    2 |        9 |
|    3 |       12 |
|    4 |        6 |
+------+----------+
4 rows in set (0.00 sec)

MySQL here implicitly sorts the results from GROUP BY (i.e.…

Facebook Twitter Google+ LinkedIn

PHP, MySQL & React REST API Tutorial with Example Form

Throughout this tutorial, we'll be using PHP with React and Axios to create a simple REST API application with CRUD operations. In the backend we'll use PHP with a MySQL database.

The PHP backend will expose a set of RESTful API endpoints so we'll be using the Axios library for making Ajax calls from the React.js UI.

We'll also see how to handle forms in React and how to send multipart form data with Axios using FormData.

In this tutorial, we are going to integrate React with PHP using Babel in the browser and a <script> tag. As such, we'll serve the React application from PHP so we don't need to enable CORS in our server since both the backend and frontend are served from the same domain.

We'll see the other approach of using two separate servers for the frontend and backend apps in another tutorial which will use the create-react-app to create the React project.

Prerequisites

You must …

[Read more]
Showing entries 4276 to 4285 of 44147
« 10 Newer Entries | 10 Older Entries »