SHOW DATABASES;
USE mysql; SELECT * FROM user \G;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
ALTER USER 'olduser'@'hostname' IDENTIFIED BY 'newpassword';
USE mysql; SET PASSWORD FOR 'user-name-here'@'hostname' = PASSWORD('new-password');
UPDATE mysql.user SET Password=PASSWORD('new-password-here') WHERE User='user-name-here' AND Host='host-name-here';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
GRANT type_of_permission ON database_name.table_name TO ‘username’@'localhost’;
REVOKE type_of_permission ON database_name.table_name FROM ‘username’@‘localhost’;
Remember to flush priveleges after GRANT/REVOKE functions!
FLUSH PRIVILEGES;
??
SHOW GRANTS FOR 'xxxx'@'xxx.xxx.xx.xx'
on old mariadb
on newer mariadb
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
can not perform only for specific table, need to dump and restore
GRANT REPLICATION SLAVE ON db.table TO 'user'@'host';
mysqldump --host 11.22.33.44 -u username -ppassword --master-data=2 \ --quick --hex-blob --add-drop-table --create-options --extended-insert \ --disable-keys --allow-keywords mydatabase mytable myview > mdump.sql
stop manually started service
mysqld_safe --skip-grant-tables --skip-networking &
systemctl stop mariadb
mysql -u root
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pass');
Books: