1. 程式人生 > >mysql安裝的備忘

mysql安裝的備忘

1. 新安裝的mysql在登陸時候,提供了一個臨時的密碼,且在使用臨時密碼登入後必須修改密碼才能繼續使用。

  使用rpm包安裝的mysql,臨時密碼儲存在/var/log/mysqld.log

  檢視臨時密碼:

   grep 'temporary password' /var/log/mysqld.log ;

2.使用臨時密碼登入:

  mysql -uroot -p'臨時密碼'

  修改密碼:

  ALTER USER 'root'@'localhost' IDENTIFIED BY '新密碼';

  PS:

    在測試的時候不想要設定很複雜的密碼,MySQL的預設密碼強度是2(strong)。

      0 or LOW    Length

      1 or MEDIUM  Length; numeric, lowercase/uppercase, and special characters; 

      2 or STRONG  Length; numeric, lowercase/uppercase, and special characters; dictionary file      

    設定的密碼強度不符合,會報錯:

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

    使用  set global validate_password_policy=0;修改密碼強度要求。

    使用 select @@validate_password_length; 檢視密碼長度要求
    +-----------------------------------------+
    | @@validate_password_length |
    +-----------------------------------------+
    | 8              |
    +-----------------------------------------+

3.應用更改:

  grant all privileges on *.* to [email protected]"%" identified by "root密碼";

  flush privileges;

  service iptables stop

PS:安裝注意的事項:

  這次是使用的rpm包在centos6.5安裝的mysql5.7版本,

  下載完整的壓縮包後,解壓出來的如下:  

  mysql-community-client-5.7.24-1.el6.x86_64.rpm  
  mysql-community-common-5.7.24-1.el6.x86_64.rpm
  mysql-community-devel-5.7.24-1.el6.x86_64.rpm
  mysql-community-embedded-5.7.24-1.el6.x86_64.rpm
  mysql-community-embedded-devel-5.7.24-1.el6.x86_64.rpm
  mysql-community-libs-5.7.24-1.el6.x86_64.rpm
  mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm
  mysql-community-server-5.7.24-1.el6.x86_64.rpm
  mysql-community-test-5.7.24-1.el6.x86_64.rpm

  安裝順序是要求為

  rpm -ivh mysql-community-common*
  rpm -ivh mysql-community-libs-5.7*
  rpm -ivh mysql-community-client*
  rpm -ivh mysql-community-server*