美文网首页
Linux 下 Mysql忘记密码处理方式

Linux 下 Mysql忘记密码处理方式

作者: 中年大叔的日常 | 来源:发表于2017-07-20 08:09 被阅读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 ;
    

    相关文章

      网友评论

          本文标题:Linux 下 Mysql忘记密码处理方式

          本文链接:https://www.haomeiwen.com/subject/ccqdkxtx.html