9久久伊人精品综合,亚洲一区精品视频在线,成 人免费va视频,国产一区二区三区黄网,99国产精品永久免费视频,亚洲毛片多多影院,精品久久久无码人妻中文字幕,无码国产欧美一区二区三区不卡
學習啦 > 學習電腦 > 操作系統 > Linux教程 > linux mysql修改密碼命令

linux mysql修改密碼命令

時間: 佳洲1085 分享

linux mysql修改密碼命令

  想知道linux下怎么修改密碼嗎?下面由學習啦小編為大家整理了linux mysql修改密碼命令,希望大家喜歡!

  linux mysql修改密碼命令

  1.修改root密碼

  linux mysql修改密碼命令方法1:使用mysqladmin命令

  --適用于記得root舊密碼,修改root密碼

  語法:

  mysqladmin -u用戶名 -p舊密碼 password 新密碼

  例如:

  # mysqladmin -u root -proot password mysql

  --注意:如當舊密碼輸入錯誤時會報如下錯誤

  # mysqladmin -u root -proot1 password mysql

  mysqladmin: connect to server at 'localhost' failed

  error: 'Access denied for user 'root'@'localhost' (using password: YES)'

  linux mysql修改密碼命令方法2:直接更新user表password字段

  --適用于忘記root密碼,而對root密碼進行重置

  Step 1: 修改MySQL的登錄設置

  # vi /etc/my.cnf

  --windows系統是my.ini文件

  --在[mysqld]的段中加上一句:skip-grant-tables,如沒有[mysqld]字段,可手動添加上

  [mysqld]

  datadir=/var/lib/mysql

  socket=/var/lib/mysql/mysql.sock

  skip-name-resolve

  skip-grant-tables

  Step 2: 重新啟動mysql

  [root@gc ~]# service mysql restart

  Shutting down MySQL..[確定]

  Starting MySQL...[確定]

  Step 3: 登錄并修改MySQL的root密碼

  --此時直接用mysql即可無需密碼即可進入數據庫了

  [root@gc ~]# mysql

  Welcome to the MySQL monitor. Commands end with ; or \g.

  Your MySQL connection id is 2

  Server version: 5.5.24 MySQL Community Server (GPL)

  Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

  Oracle is a registered trademark of Oracle Corporation and/or its

  affiliates. Other names may be trademarks of their respective

  owners.

  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  mysql> use mysql;

  Database changed

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

  Query OK, 5 rows affected (0.00 sec)

  Rows matched: 5 Changed: 5 Warnings: 0

  mysql> flush privileges;

  Query OK, 0 rows affected (0.00 sec)

  --注意:如果沒做step1,直接用mysql登錄時會報如下錯誤

  [root@gc ~]# mysql

  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

  Step 4: 將MySQL的登錄設置修改回來

  再刪除/etc/my.cnf文件中的skip-grant-tables

  Step 5: 重新啟動mysql

  [root@gc ~]# service mysql restart

  Shutting down MySQL..[確定]

  Starting MySQL...[確定]

  2.修改mysql其它用戶密碼

  同樣,普通用戶也可以用上面的方法

  --使用mysqladmin命令

  [root@njdyw ~]# mysqladmin -u user1 -ppass1 password pass2

  --直接修改數據庫表

  [root@njdyw ~]# mysql -u user1 -ppass1 –Dmysql

  mysql> update user set password=password('pass2') where user='user1';

  mysql> flush privileges;

3572049 主站蜘蛛池模板: 99久久99久久精品免费看蜜桃| 国产精品午夜福利精品| 亚洲偷自拍国综合| 另类图片亚洲人妻中文无码| 欧洲尺码日本尺码专线美国又| 不卡在线一区二区三区视频| 亚洲区一区二区激情文学| 黄色三级亚洲男人的天堂| 国产精品日日摸夜夜添夜夜添2021| 伊人天天久大香线蕉av色| 精品无码人妻一区二区三区| 99热久久这里只有精品| 国产精品自偷一区在线观看| a级国产乱理伦片在线观看al| 亚洲av无码成人精品区一区| 亚洲色欲在线播放一区| 国产精品人成视频免费播放| 国产精品一二三中文字幕| 中国女人熟毛茸茸A毛片| 国产精品老年自拍视频| 一本加勒比hezyo无码人妻| 四虎国产精品成人免费久久| 亚洲欧美日韩在线码| 亚洲AV网一区二区三区| 漂亮的保姆hd完整版免费韩国| 精品国产午夜福利理论片| 色窝窝免费播放视频在线| 中文字幕一区日韩精品| av 日韩 人妻 黑人 综合 无码 | 国产成人亚洲综合图区| 男女性高爱潮免费网站| 日韩av一区二区三区不卡| 中文字幕国产精品一区二| 性虎精品无码AV导航| 国产成人精品1024免费下载| 日本亚洲色大成网站www久久 | 日韩av不卡一区二区在线| 无码福利写真片视频在线播放 | 中文字幕日韩精品国产| 9久久精品视香蕉蕉| 国产高清一区二区不卡|