mysqlcommands
This is an old revision of the document!
Table of Contents
MySQL Commands
mysql -u root -p mysql -h ubuntu-vb -u root -p mysql -u root -p football select version(), current_date, now(), current_user; show databases; create database football; use football; show tables; select database(); mysqlshow -u root -p --count football show binary logs; show master status; flush binary logs; show status like '%Connections%'; show variables like '%bin%';
Passwords and User Accounts
Global variables can be used to manage user passwords …
These can be overridden at the user level.
default_password_lifetime = 120 (Time in days before password expires) password_history = 5 (Number of passwords that must be different) password_reuse_interval = 180 (Prohibit reuse of passwords during number of days specified) alter user 'ian'@'localhost' password expire; alter user 'ian'@'localhost' password expire never; alter user 'ian'@'localhost' password expire interval 180 day; alter user 'ian'@'localhost' password history default; alter user 'ian'@'localhost' password history 2; alter user 'ian'@'localhost' password reuse interval 360; alter user 'ian'@'localhost' account lock; grant all on football.* to 'ian'@'localhost'; select user from mysql.user; select user, password_expired, password_last_changed, password_lifetime, account_locked from mysql.user;
Backups and Recovery
mysqldump -uroot -p --all-databases > mysqldb.sql
mysqlcommands.1549447018.txt.gz · Last modified: 2025/03/08 22:23 (external edit)