mysql -h localhost -uroot -p
mysqldump -uroot -p db > db.sql
mysql -uroot -p db < db.sql // or mysql -uroot -p db -e "source /path/to/db.sql"
grant all privileges on ss.* to ‘root‘@‘%‘ indentified by ‘passoword‘ with grant option; // or update user set Host="%" and User="root" // 注意%是不包含localhost的 flush privileges;
CREATE USER ‘test‘@‘localhost‘ IDENTIFIED BY ‘password‘; grant all privileges on *.* to test@‘localhost‘ identified by ‘test‘;
CREATE SCHEMA testdb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON testdb.* TO ‘test‘@‘localhost‘;
原文:https://www.cnblogs.com/shareinfo/p/12169940.html