Şöyle yaparız
DESC emp
GRANT select, insert ON test.* TO 'test'@'localhost' IDENTIFIED BY '123'# View account permissionsSHOW GRANTS FOR 'test'@'localhost'# Withdraw operation authorityREVEOKE INSERT ON test.* FROM 'test'@'localhost'
When querying using a non-clustered index, the database performs an index seek to first locate the index key and the clustered index.
If the requested data is not in the non-clustered index tree, the database performs a key lookup in the clustered index tree to retrieve the entire row and join the data.
This key lookup incurs additional I/O and can slow down the query.
When querying using a non-clustered index, the database performs an index seek to first locate the index key and the clustered index.
If the requested data is not in the non-clustered index tree, the database performs a key lookup in the clustered index tree to retrieve the entire row and join the data.
This key lookup incurs additional I/O and can slow down the query.
To mitigate this issue, you can use the INCLUDE command to include non-key columns in the non-clustered index tree.
CREATE INDEX idx_example ON employee_tab (name) INCLUDE (age);
CREATE PROCEDURE myproc()BEGINDECLARE i INT DEFAULT 1;WHILE i <= 1000000 DOINSERT INTO dbmap (id,name,ssn) VALUES (i,CONCAT('name',i),CONCAT('SSN',i));SET i = i+1;END WHILE;END
call myproc()
CREATE PROCEDURE myproc(IN NumRows INT)BEGIN DECLARE i INT DEFAULT 1; WHILE i <= NumRows DO insert into dbmap (id,name,ssn) values (i,CONCAT('name', i), CONCAT('ssn' , i)); SET i = i+1; END WHILE; END
CALL myproc(100000)
CREATE PROCEDURE testdb.BulkInsert()
BEGIN
DECLARE i INT DEFAULT 1;
truncate table employee1;
truncate table employee2;
WHILE (i <= 20000) DO
INSERT INTO testdb.employee1 (id, FirstName, Address)
VALUES(i, CONCAT("user","-",i), CONCAT("address","-",i));
INSERT INTO testdb.employee2 (id,FirstName, Address)
VALUES(i,CONCAT("user","-",i), CONCAT("address","-",i));
SET i = i+1;
END WHILE;
END
mysql> CALL testdb.BulkInsert() ;$ brew install mysql-shell
$ mysqlsh --host=127.0.01 --port=3306 --user=root --password=root
\ use db
\ sql
select max(id) from dbmap;
jdbc:mysql://localhost:3306/jdbc_demo
jdbc:mysql://localhost:3306/mydatabase?user=myusername&password=mypassword
jdbc:mysql://192.168.29.20:3306,192.168.29.20:6306/adv
The host list in the connection URL comprises of two types of hosts, the primary and the secondary. When starting a new connection, the driver always tries to connect to the primary host first and, if required, fails over to the secondary hosts on the list sequentially when communication problems are experienced. Even if the initial connection to the primary host fails and the driver gets connected to a secondary host, the primary host never loses its special status: for example, it can be configured with an access mode distinct from those of the secondary hosts, and it can be put on a higher priority when a host is to be picked during a failover process.
autoReconnect=true in the connection string, which makes the connection to auto recover.
"jdbc:mysql://localhost:yourPortNumber/yourDatabaseName?autoReconnect=true";
jdbc:mysql://myexample.com:3306/pets?logger=Slf4JLogger&explainSlowQueries=true
jdbc:mysql://... &useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
jdbc:mysql://localhost:3306/db?sessionVariables=sql_mode=ANSI_QUOTES
SELECT * FROM "account" WHERE "deleted" IS NULL ORDER BY "account_name"
connectTimeoutDefault value: 0Unit: millisecondConfigure the connection timeout time, through the connect(SocketAddress endpoint, int timeout) method of the Socket object to configuresocketTimeoutDefault value: 0Unit: msConfigure the timeout time of the socket, and configure it through the setSoTimeout(int timeout) method of the Socket object
jdbc:mysql://xxx.xx.xxx.xxx:3306/database?connectTimeout=60000&socketTimeout=60000
Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:101) at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:144) at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:174) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3008) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3469)
"jdbc:mysql://localhost:yourPortNumber/yourDatabaseName?autoReconnect=true&useSSL=false";
"jdbc:mysql://127.0.0.1:3306/mydb?
useUnicode=true&
characterEncoding=UTF-8&
useServerPrepStmts=false&
rewriteBatchedStatements=true"By default the MySQL driver does not support batching because of how it handles queries. To enable batching we have to tell it to rewrite queries by adding ?rewriteBatchedStatements=true to your JDBC URL.
In MySQL, the useCursorFetch parameter is a JDBC driver-specific option that can be used to enable or disable cursor-based fetching for result sets. Cursor-based fetching allows fetching rows from the result set in smaller chunks (cursors) instead of loading the entire result set into memory at once.When useCursorFetch is set to true, the MySQL JDBC driver uses server-side cursors to fetch rows in chunks. This can be beneficial when dealing with large result sets as it reduces memory consumption and can improve performance.Here's an example of how to enable useCursorFetch in a MySQL JDBC connection string:String jdbcUrl = "jdbc:mysql://your_host:your_port/your_database?useCursorFetch=true";In the JDBC connection URL, appending ?useCursorFetch=true at the end enables the cursor-based fetching mode for the MySQL JDBC driver.
Ö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 ...