在centos7上使用mysql

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm 

cd /etc/yum.repos.d/

sudo yum install mysql-server
已安裝:
  mysql-community-libs.x86_64 0:5.7.29-1.el7                                    
  mysql-community-libs-compat.x86_64 0:5.7.29-1.el7                             
  mysql-community-server.x86_64 0:5.7.29-1.el7                                  

作爲依賴被安裝:
  mysql-community-client.x86_64 0:5.7.29-1.el7                                  
  mysql-community-common.x86_64 0:5.7.29-1.el7                                  

替代:
  mariadb-libs.x86_64 1:5.5.64-1.el7 

rpm -qa|grep mysql
mysql-community-client-5.7.29-1.el7.x86_64
mysql57-community-release-el7-9.noarch
mysql-community-libs-compat-5.7.29-1.el7.x86_64
mysql-community-server-5.7.29-1.el7.x86_64
mysql-community-common-5.7.29-1.el7.x86_64
mysql-community-libs-5.7.29-1.el7.x86_64

(base) [260254@w26-260254 yum.repos.d]$ sudo grep 'temporary password' /var/log/mysqld.log

(base) [260254@w26-260254 yum.repos.d]$ rm -rf /var/lib/mysql
rm: 無法刪除"/var/lib/mysql": 權限不夠

(base) [260254@w26-260254 yum.repos.d]$ sudo rm -rf /var/lib/mysql

(base) [260254@w26-260254 yum.repos.d]$ systemctl start mysqld

(base) [260254@w26-260254 yum.repos.d]$ sudo grep 'temporary password' /var/log/mysqld.log
2020-04-14T08:07:03.521738Z 1 [Note] A temporary password is generated for root@localhost: 4Svk1r>ahOlK

(base) [260254@w26-260254 yum.repos.d]$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29

Copyright (c) 2000, 2020, 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> ALTER USER USER() IDENTIFIED BY 'Dx1.....';
Query OK, 0 rows affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
mysql> create database db_0;
Query OK, 1 row affected (0.00 sec)
mysql> drop database db_0;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> SHOW VARIABLES LIKE 'validate_password%'; 
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password_check_user_name    | OFF   |
| validate_password_dictionary_file    |       |
| validate_password_length             | 4     |
| validate_password_mixed_case_count   | 1     |
| validate_password_number_count       | 1     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 1     |
+--------------------------------------+-------+
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章