linux:ubuntu_mariadb_mysql_cheat_sheet
MariaDB MySQL Cheat Sheet
Show all current connections with host names sorted by db
Show All Open Queries And Transactions
Allow Remote Connection Non-Specific
GRANT <privilige level> ON *.* TO 'username'@'%' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Allow Remote Connection Specific
GRANT <privilige level> ON dbname.* TO username@'xx.xx.xx.xx' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;
Kill A Query Or Transaction
kill <Id>;
Create User
Delete User
Show Password Hash For Given Password
Show Logged In Users
SELECT USER(),CURRENT_USER();
Show All Users And Password Hash
SELECT host, user, password FROM mysql.user;
Note: For MySQL replace password with authentication_string
Lock An Account
Unlock an account
Export DB Schema
Import DB Schema
mysql -u root -p dbname < schema.sql
Show Binlog Events
Show InnoDB Pool Buffer Size
Convert Myisam To InnoDB
SET @DATABASE_NAME = 'name_of_your_db'; SELECT CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements FROM information_schema.tables AS tb WHERE table_schema = @DATABASE_NAME AND `ENGINE` = 'MyISAM' AND `TABLE_TYPE` = 'BASE TABLE' ORDER BY table_name DESC;
You will get a list of tables to alter that you can paste into mysql.
Create A Database Backup
Click [here] for info regarding this topic.
Clear ib_logfiles
Click [here] for info regarding this topic.
Fixing Slave Error 1146
Click [here] for info regarding this topic.
linux/ubuntu_mariadb_mysql_cheat_sheet.txt · Last modified: 08/12/2022 09:44 by Allan