tips
8 tips Mysql
One command, setting or habit at a time about Mysql: what it does, the line to copy and a caveat or two.
Admin and checks 5
-
Applies a server setting immediately without editing a config file.
SET PERSIST max_connections = 300; -
Makes a schema change fail fast instead of starting a long table rebuild.
ALTER TABLE orders ADD COLUMN note VARCHAR(100), ALGORITHM=INSTANT; -
Lets old and new passwords both work while applications are updated.
ALTER USER 'appuser'@'192.0.2.10' -
Finds candidates for removal that only slow down writes.
SELECT * FROM sys.schema_unused_indexes -
Checks whether the MySQL server is up and prints a one-line status with uptime, threads and queries.
mysqladmin -u root -p ping
SQL shells 2
-
Stores host, user and password so you stop typing them in commands.
mysql_config_editor set --login-path=shop \ -
Starts the mysql client in a mode that refuses UPDATE and DELETE statements that could hit the whole table.
mysql --safe-updates -u root -p
Query tuning 1
-
Makes a locking read skip rows that another transaction has locked, instead of waiting.
FOR UPDATE SKIP LOCKED;
Nothing in this filter yet.