Şöyle yaparız
> EXPLAIN FORMAT=JSON INTO @myselect SELECT name FROM a WHERE id = 2;Query OK, 0 rows affected (0.00 sec)> SELECT @myselect\G
> EXPLAIN FORMAT=JSON INTO @myselect SELECT name FROM a WHERE id = 2;Query OK, 0 rows affected (0.00 sec)> SELECT @myselect\G
Previously, MySQL 5.6/5.7 used mysql_native_password as the default password plugin. The mysql_native_password plugin does not require an encrypted connection.This plugin is very fast in authentication but not secure enough because it uses the SHA1 algorithm, which has been recommended against by NIST (National Institute of Standards and Technology) due to its vulnerability to attacks.
Since MySQL 5.6, a more secure authentication mechanism was introduced: the sha256_password authentication plugin. It uses a salted password for multiple rounds of SHA256 hashing (thousands of rounds), making brute-force attacks much harder and ensuring more secure hash transformations.However, establishing a secure connection and multiple rounds of hash encryption are time-consuming, offering higher security but slower authentication speed.
MySQL aimed to combine the advantages of both methods. In MySQL 8.0.3, a new authentication plugin caching_sha2_password was introduced as an alternative to sha256_password.
Since MySQL 8.0.4, the default authentication plugin has been changed from mysql_native_password to caching_sha2_password. Accordingly, libmysqlclient also uses caching_sha2_password as the default authentication mechanism.
Starting from MySQL 9.0.0, the following Event syntax is available:CREATE EVENT (create event)ALTER EVENT (modify event)DROP EVENT (delete event)EVENT statements do not support the use of placeholder parameters (?).
CREATE EVENT event_nameON SCHEDULE AT or EVERY + specified interval DO SQL_statement
CREATE EVENT myeventON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOURDOUPDATE myschema.mytable SET mycol = mycol + 1;
When using the soft delete mechanism on the database, you might run into a situation where a record with a unique constraint was deleted and you want to reuse the unique value.
If your database does not have partial indexes, e.g. MySQL, you could use a different approach with virtual columns.Considering that in most SQL databases, the UNIQUE constraint ignores NULL values, we can use a composite key in the UNIQUE constraint that includes a nullable column that indicates if a record was deleted.To do so, we can add a virtual column not_archived that gets its value from the soft delete column.
ALTER TABLE users ADD not_archived BOOLEAN GENERATED ALWAYS AS (IF(deleted_at IS NULL, 1, NULL)) VIRTUAL;
This will result in a field that gets automatically updated according to the deleted_at column. It will have the value 1 when the record is not deleted (deleted_at=NULL), else it will be NULL. Now we just need to add it to the UNIQUE constraint. Remember to drop the old constraint.
ALTER TABLE users ADD CONSTRAINT UNIQUE (email, not_archived);
For instance, the UUID() MySQL function returns a version 1 UUID number.And the Java UUID.randomUUID() function returns a version 4 UUID number.
Örnek Şöyle yaparız SELECT t1.name, t1.age, t1.gender, t1.create_time FROM student as t1 INNER JOIN (SELECT id FROM student ORDER BY ...