一、重置Mysql的root密码
方法一:
直接进入localhost/phpmyadmin修改用户root的权限,设置密码;
方法二:
进入mysql控制台;
mysql->use mysql;
mysql->update user set password=password("123456") where user="root";
mysql->flush privileges; // 刷新个*限设置
mysql->quit
二、用户权限设置
CREATE DATABASE test;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON test.* TO test@localhost IDENTIFIED BY 'test123';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON test.* TO test@"%" IDENTIFIED BY 'test123';
GRANT all privileges ON test.* TO test@"%" IDENTIFIED BY 'test123';
GRANT all privileges ON test.* TO test@localhost IDENTIFIED BY 'test123';
flush privileges;
#删除授权:
mysql> revoke all privileges on test.* from test@”%”;
mysql> delete from user where user=”test” and host=”%”;
mysql> flush privileges;
#数据库备份代码
mysqldump -u test -p test123 databasename>/alidata/www/sharcom_plat/databasename_$(date +%Y%m%d_%H%M%S).sql
mysqldump -u test -p test123 databasename | gzip > /alidata/www/sharcom_plat/databasename_$(date +%Y%m%d_%H%M%S).sql.gz