Mysql Advanced
Common Issues and Tips
- If database gets locked
- Increase Max Connections:
- Check Connected Threads:
- Show how much space are DBs using:
MySQL
select table_schema, sum((data_length+index_length)/1024/1024/1024) AS G from information_schema.tables group by 1;
MySQL
SELECT table_schema "DB name", sum( data_length + index_length ) / 1024 / 1024 / 1024 "DB size in GB", sum( data_free )/ 1024 /
1024 / 1024 "free/reclaimable space in GB" FROM information_schema.TABLES GROUP BY table_schema;
Update Examples:
Update Password
MySQL
update TableCredentials set password = "$2a$10$iL5PhyBOaezbVkeweSneh.PMd8Y025Sk0De5lQYC8sJaHwOQISuca" where username = "[email protected]";
Insert Row
The number of columns and values should match; otherwise, it fails.
MySQL
INSERT INTO table_name (column_1, column_2, column_3, ...)
VALUES
(value_list_1),
(value_list_2),
...
(value_list_n);
Optimize
- remote