====== MySQL ====== ==== Update MySQL root password ==== sudo mysqladmin -u root -p password '' ==== Allow MySQL root remote access ==== update mysql.user set host = '%' where user = 'root'; ==== Create backup account ==== create user backupuser@localhost identified by 'backuppassword'; grant lock tables, select on *.* to backupuser@localhost identified by 'backuppassword'; ==== MySQL backup & restore SQL file ==== mysqldump -ubackupuser -pbackuppassword --all-databases --add-drop-database > all.sql mysql -ubackupuser -pbackuppassword < all.sql; ==== Create account and assign privileges on a database ==== create user @localhost identified by ''; grant all privileges on .* to @localhost identified by ''; ==== Show all accounts ==== select user,host,password from mysql.user; ==== Create database using UTF-8 charset ==== CREATE database IF NOT EXISTS default charset utf8 COLLATE utf8_general_ci;