yum安装mysql5.7

IT
IT
IT
335
文章
1
评论
2020年3月22日19:25:38 评论 1,104 1868字阅读6分13秒

安装yum源

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

安装rpm包

yum -y install mysql57-community-release-el7-10.noarch.rpm

安装

yum -y install mysql-community-server

启动

systemctl start  mysqld.service

查看启动的服务

systemctl status mysqld.service

查看初始密码

grep "password" /var/log/mysqld.log
2019-11-25T12:02:44.304248Z 1 [Note] A temporary password is generated for root@localhost: ,b-Ppr.lt1R6

登陆服务器,修改密码

[xiaoxin@iZ2zee6df2m25shq6mfaw5Z ~]$ mysql -uroot -p,b-Ppr.lt1R6
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28
 
Copyright (c) 2000, 2019, 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 'root'@'localhost' IDENTIFIED BY 'root2758';   ###密码设置的过于简单,得设置复杂一点
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'XIAOXIN@root2758'; ####复杂一点
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'validate_password%'; ####查看密码规则
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_check_user_name    | OFF    |
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| 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.00 sec)

因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉

yum -y remove mysql57-community-release-el7-10.noarch

查看版本

mysql> SHOW VARIABLES WHERE Variable_name = 'version';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| version       | 5.7.28 |
+---------------+--------+
1 row in set (0.00 sec)
继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
DB Mysql 最后更新:2020-4-11
IT
  • 本文由 发表于 2020年3月22日19:25:38
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
MySQL备份与恢复 DB

MySQL备份与恢复

备份和恢复discuz库 # mysqldump -uroot -p654321 discuz > /data/discuz.sql //备份discuz库 # mysql -uroot -p6...
yum安装mysql5.6 DB

yum安装mysql5.6

卸载mariadb # yum -y remove mariadb-libs 安装MySQL的yum源 # yum -y install http://dev.mysql.com/get/mysql-...
Mysql授权 DB

Mysql授权

授权一个指定账号 # mysql -uroot -p123456 mysql: Using a password on the command line interface can be insecu...