MySQLデータベースには、パスワードを変更する名前を変更しました

  • パスワード(古いバージョン)を変更します。

      mysql -u root -p  
      Enter password:***  
      mysql>use mysql;      --选择数据库-- 
      Database changed   
      mysql> UPDATE user SET password=PASSWORD("新密码") WHERE user='你的用户名';  mysql> FLUSH PRIVILEGES;  mysql> quit; 
  • 新しくインストールされたMySQL5.7は、パスワードエラーを求められたら、インストールは、パスワードなしのログインパスワードを変更する、入力したパスワードは変更されません。

      update mysql.user  set password=password('root') where user='root';

    プロンプト

      ERROR 1054 (42S22): Unknown column 'password' in 'field list',

    オリジナルは、mysqlデータベースがauthentication_stringにはパスワードのこのフィールドは、パスワードフィールドを持っていないです

  • だから、文が交換された変更

      update mysql.user set authentication_string=password('root') where user='root';
  • 変更ユーザー名:

      mysql -u root -p  
      Enter password:***  
      mysql> use mysql;          --选择数据库--
      Database changed  
      mysql> update user set user="新用户名" where user="root"; --将用户名为root的改为新用户名--  mysql> flush privileges; --刷新权限--  mysql> exit

 

この記事の出所:https://www.cnblogs.com/renxiuxing/p/9053910.html

おすすめ

転載: www.cnblogs.com/flower-0626/p/11647018.html