国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql學習之-密碼管理 默認密碼 修改密碼 處理忘記密碼

2024-07-24 12:35:19
字體:
來源:轉載
供稿:網友
       mysql學習之-密碼管理 默認密碼 修改密碼 處理忘記密碼:

  1. mysql安裝后默認沒有密碼,初始化安裝后默認密碼登錄,需要馬上修改root密碼。
  [root@mysql ~]# cat /root/.mysql_secret    --查看root賬號密碼
  # The random password set for the root user at Tue Dec 13 18:59:06 2016 (local time): 7MhtyX3aZEl9OUf8
  [root@mysql ~]# mysql -uroot -p    -- 登錄mysql
  Enter password:               --(此處復制粘貼 7MhtyX3aZEl9OUf8)
  Welcome to the MySQL monitor.  Commands end with ; or /g.
  Your MySQL connection id is 2
  Server version: 5.6.25
  Copyright (c) 2000, 2015, 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>   表示一切順利成功。
 
  2.   忘記mysql數據庫root的密碼后,如何修改密碼。
  [root@mysql etc]# service mysql stop   --停止mysql進程
  Shutting down MySQL.... SUCCESS!
  [root@mysql etc]# mysqld_safe --skip-grant-tables&  --啟動mysql時不啟動grant-tables,授權表。執行后出現下面畫面,另起一個新會話。
  [1] 3574
  [root@mysql etc]# 161215 06:13:53 mysqld_safe Logging to '/var/lib/mysql/mysql.err'.
  161215 06:13:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  [root@mysql ~]# ps -ef|grep mysql   --查看mysql進程是否起來
  root       3467   3440  0 05:29 pts/2    00:00:00 mysql -uandy -px xx
  root       3574   2845  0 06:13 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
  mysql      3677   3574  2 06:13 pts/0    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-
  mysql> UPDATE user SET password=PASSWORD('cccccc') WHERE user='root';   --更改root密碼
  Query OK, 4 rows affected (0.04 sec)
  Rows matched: 4  Changed: 4  Warnings: 0
  mysql> FLUSH PRIVILEGES;    --權限更新
  Query OK, 0 rows affected (0.00 sec)
  [root@mysql ~]# mysql -uroot -p123456    --使用舊密碼登錄,發現不行,說明密碼已經更新
  Warning: Using a password on the command line interface can be insecure.
  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
  [root@mysql ~]# mysql -uroot -pcccccc   --新密碼登錄成功
  Warning: Using a password on the command line interface can be insecure.
  Welcome to the MySQL monitor.  Commands end with ; or /g.
  mysql>

(編輯:武林網)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 恭城| 尼勒克县| 托克逊县| 河北省| 南江县| 宁河县| 射洪县| 黄石市| 嘉定区| 浦北县| 乌兰浩特市| 云梦县| 乌拉特中旗| 诏安县| 梅河口市| 霍林郭勒市| 招远市| 高安市| 平遥县| 黎平县| 潞西市| 樟树市| 通榆县| 兴业县| 墨脱县| 郓城县| 芦山县| 隆化县| 阳泉市| 鸡东县| 南平市| 盱眙县| 新民市| 册亨县| 呼伦贝尔市| 绩溪县| 恩平市| 虎林市| 武乡县| 额尔古纳市| 周口市|