zoukankan      html  css  js  c++  java
  • ubuntu安装mysql添加密码

    ubuntu安装mysql5.7后没有密码,添加密码。

    这里是关键点,由于mysql5.7没有password字段,密码存储在authentication_string字段中,password()方法还能用

    在mysql中执行下面语句修改密码

    show databases;
     
    use mysql;
      
    update user set authentication_string=PASSWORD("自定义密码") where user='root';
      
    update user set plugin="mysql_native_password";
      
    flush privileges;
      
    quit;

    Ubuntu 重置MySQL Root密1.停止MySQL服务

    $ service mysql stop

     

    2.跳过认证启动MySQL服务

    $ mysqld_safe --skip-grant-tables

    3.免密码登录MySQL

    $ mysql -u root

     mysql> use mysql;

    MySQL 5.7 以前版本

    mysql> update user set Password=PASSWORD('new_password') where user='root';

    MySQL 5.7 以后版本(Password字段改为了authentication_string)

    mysql> update user set authentication_string=PASSWORD('new_password') where user='root';

    mysql> flush privileges;

    mysql> exit;

    4.开启MySQL服务

    $ service mysql start

    5.使用刚刚重置的新密码登录

    $ mysql -u root -p 

  • 相关阅读:
    Ellipsis 的升级版 line-clamp
    Angular7里面实现 debounce search
    闭包、迭代器
    Day10 函数的进阶
    函数
    文件的操作
    Day 07基础数据补充、set、深浅拷贝
    小数据池,编码和解码
    字典
    列表、元祖的操作
  • 原文地址:https://www.cnblogs.com/shenZS/p/13541707.html
Copyright © 2011-2022 走看看