Linux 下 Mysql忘记密码处理方式
2017-07-20 本文已影响14人
中年大叔的日常
免认证启动mysql
mysqld_safe --skip-grant-tables &
命令行修改密码
mysql> use mysql;
mysql> update user set password=password('new_password') where user='root';
mysql> flush privileges;
创建数据库
CREATE DATABASE DB_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE embodaily DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
创建用户并设置权限
create user gopub IDENTIFIED by 'welovetime';
create user user IDENTIFIED by 'xxxxx';
rename user feng to newuser;
drop user newuser;
set password for zx_root =password('xxxxxx');
update mysql.user set password=password('xxxx') where user='otheruser'
show grants for zx_root;
grant select on dmc_db.* to zx_root;
grant ALL on dmc_db.* to zx_root;
grant all privileges on testdb to dba@’localhost’
flush privileges ;