特黄特色三级在线观看免费,看黄色片子免费,色综合久,欧美在线视频看看,高潮胡言乱语对白刺激国产,伊人网成人,中文字幕亚洲一碰就硬老熟妇

學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > linux mysql修改密碼命令

linux mysql修改密碼命令

時(shí)間: 佳洲1085 分享

linux mysql修改密碼命令

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

  linux mysql修改密碼命令

  1.修改root密碼

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

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

  語(yǔ)法:

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

  例如:

  # mysqladmin -u root -proot password mysql

  --注意:如當(dāng)舊密碼輸入錯(cuò)誤時(shí)會(huì)報(bào)如下錯(cuò)誤

  # 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密碼,而對(duì)root密碼進(jìn)行重置

  Step 1: 修改MySQL的登錄設(shè)置

  # vi /etc/my.cnf

  --windows系統(tǒng)是my.ini文件

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

  [mysqld]

  datadir=/var/lib/mysql

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

  skip-name-resolve

  skip-grant-tables

  Step 2: 重新啟動(dòng)mysql

  [root@gc ~]# service mysql restart

  Shutting down MySQL..[確定]

  Starting MySQL...[確定]

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

  --此時(shí)直接用mysql即可無需密碼即可進(jìn)入數(shù)據(jù)庫(kù)了

  [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登錄時(shí)會(huì)報(bào)如下錯(cuò)誤

  [root@gc ~]# mysql

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

  Step 4: 將MySQL的登錄設(shè)置修改回來

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

  Step 5: 重新啟動(dòng)mysql

  [root@gc ~]# service mysql restart

  Shutting down MySQL..[確定]

  Starting MySQL...[確定]

  2.修改mysql其它用戶密碼

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

  --使用mysqladmin命令

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

  --直接修改數(shù)據(jù)庫(kù)表

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

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

  mysql> flush privileges;

3572049