DB selection
use myDatabaseName
DB create
CREATE DATABASE example1;
Review the newly created DB
SHOW CREATE DATABASE example1;
Show current character set of a db
SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "test1";
Change the character set
ALTER DATABASE test1 CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Dump DB to file
mysqldump -u root -R oldDbName > oldDbName.sql
Import .sql file to DB
mysql -u root newDbName < inputFile.sql
Show the values of MariaDB system variables
SHOW VARIABLES;
To fragment a table to reclaim disk space
ALTER TABLE <name> FORCE;
OPTIMIZE TABLE <name>;
mysqldump db-name | mysql -h db-1.example.com -u ross -p db-name