亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
前言 MySQL的使用 MySQL多表同時(shí)刪除方案 MySQL跨表、多表更新SQL語句總結(jié) MySQL存儲(chǔ)引擎 安裝 常規(guī)方式編譯安裝MySQL 采用cmake方式編譯安裝MySQL 使用rpm包安裝MySQL 使用yum方式安裝MySQL 采用二進(jìn)制方式免編譯安裝MySQL 多實(shí)例的安裝 什么是多實(shí)例 多實(shí)例的作用、問題以及應(yīng)用場(chǎng)景 多實(shí)例安裝01【推薦】 多實(shí)例官方安裝方案02 啟動(dòng)、用戶和權(quán)限管理 單實(shí)例MySQL的啟動(dòng)和關(guān)閉的方法 設(shè)置及修改MySQL root用戶密碼 找回丟失的MySQL root用戶密碼 創(chuàng)建MySQL用戶及用戶權(quán)限管理 基礎(chǔ)命令的操作 MySQL庫和表相關(guān)操作 MySQL中的索引操作 MySQL常用命令 MySQL的錯(cuò)誤代碼 MySQL復(fù)習(xí)秘籍 備份與恢復(fù) 備份 恢復(fù) mysqlbinlog命令 服務(wù)日志 主從復(fù)制 主從復(fù)制部署配置問題匯總 主從復(fù)制讀寫分離 災(zāi)難恢復(fù) 配置phpmyadmin連接多實(shí)例MySQL MySQL語句大全 用戶創(chuàng)建、權(quán)限、刪除 數(shù)據(jù)庫與表顯示、創(chuàng)建、刪除 Mysql表復(fù)制及備份還原 數(shù)據(jù)庫表中數(shù)據(jù)操作 修改表中的指定一條數(shù)據(jù) 查詢表 日志 批量修改Mysql表引擎為InnoDB的方法 數(shù)據(jù)庫抽象層 PDO PDO對(duì)象常用方法 PDO 事務(wù)處理 PDO 與 MySQLi 二者效率簡(jiǎn)單比較 大小寫敏感性 lower_case_table_names CentOS7安裝MySQL5.7密碼查看與修改
characters

CentOS7 安裝 Mysql 5.7密碼查看與修改

軟件版本

CentOS release 6.9 (Final)
mysql Client Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using  EditLine wrapper
mysql Server 5.7.18

檢測(cè)是否安裝MySQLServer

檢測(cè)下系統(tǒng)有沒有自帶的mysql:yum list installed | grep mysql

如果已經(jīng)有的話執(zhí)行命令 yum -y remove mysql-libs.x86_64 卸載已經(jīng)安裝的 MySQL 。

安裝

使用 rpm 包進(jìn)行mysql服務(wù)器的安裝,具體下載地址在:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

wget http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql-community-server-5.7.18-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm

啟動(dòng)

service mysqld start

查看密碼

安裝完成之后會(huì)自動(dòng)在 /var/log/mysqld.log 中生成連接的密碼, 使用 grep "temporary password" /var/log/mysqld.log 命令查看生成的密碼。

初次登錄MySQL客戶端必須重新設(shè)置密碼才能進(jìn)行數(shù)據(jù)的操作,如下:

[root@localhost src]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.18
Copyright (c) 2000, 2017, 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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

密碼設(shè)置

不過需要注意的是現(xiàn)在MySQL已經(jīng)強(qiáng)制要求強(qiáng)密碼,已經(jīng)不能再用弱密碼比如“123456”了。如果你設(shè)置的密碼過于簡(jiǎn)單,會(huì)提示錯(cuò)誤:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

set password 命令

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

mysqladmin 命令

mysqladmin -u root password "newpass" # 如果root沒有設(shè)置密碼使用這種方式
mysqladmin -u root password oldpass "newpass" # 如果root設(shè)置了密碼使用這種方式

使用 update 語句

UPDATE user SET authentication_string = PASSWORD('newpass') WHERE user = 'root';

忘記密碼

mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET authentication_string=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;

密碼復(fù)雜度的修改

mysql> show variables like "validate_password%";
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      | # 必須8個(gè)字符以上
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | MEDIUM | # 具體看下面的配置
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+
7 rows in set (0.01 sec)
mysql> SET GLOBAL  validate_password_policy='LOW';
Query OK, 0 rows affected (0.00 sec)
mysql> SET GLOBAL validate_password_length = 6;
Query OK, 0 rows affected (0.00 sec)
  • LOW政策只測(cè)試密碼長(zhǎng)度。 密碼必須至少有8個(gè)字符長(zhǎng)。

  • MEDIUM政策的條件 密碼必須包含至少1數(shù)字字符,1 大寫和小寫字符,和1特別 (nonalphanumeric)字符。

  • STRONG政策的情況 密碼子字符串長(zhǎng)度為4的或更長(zhǎng)時(shí)間不能匹配 單詞在字典文件中,如果一個(gè)人被指定。

再進(jìn)行密碼的修改試試。

創(chuàng)建用戶并授權(quán)

CREATE USER 'test'@'%' IDENTIFIED BY 'password';
GRANT ALL ON test.* TO 'test'@'%' WITH GRANT OPTION;


Previous article: Next article: