mysql安装教程
MySQL安装配置
- 官网下载地址
2.检测本地是否有mysql已存在的包
rpm -qa | grep mysql
3.检测本地是否有mariadb已存在的包
rpm -qa | grep mariadb
4.如果存在,则使用yum命令卸载
mariadb-libs-5.5.56-2.el7.x86_64
yum -y remove mariadb-libs-5.5.56-2.el7.x86_64
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
5.创建一个文件夹,上传jar包到/opt/software/mysql
mkdir /opt/software/mysql
6.解压mysql jar包
tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar -C /opt/module/mysql
7.安装mysql的 server、client、common、libs、lib-compat
rpm -ivh --nodeps mysql-community-server-5.7.19-1.el7.x86_64.rpm
rpm -ivh --nodeps mysql-community-client-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm
8.查看mysql的服务是否启动
systemctl status mysqld
Active: inactive (dead)
9.启动mysql的服务
systemctl start mysqld
10.再次检查mysql的服务是否启动
systemctl status mysqld
Active: active (running) since Thu 2019-03-21 07:23:08 EDT; 2s ago
11.查看默认生成的密码
cat /var/log/mysqld.log | grep password
2019-03-21T11:23:01.643479Z 1 [Note] A temporary password is generated for root@localhost: iwkJGgd:j6jO
12.登录mysql服务
mysql -uroot -p’然后粘贴上密码’
13.修改mysql密码规则
Query OK, 0 rows affected (0.05 sec)
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_number_count=3;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
密码最小长度,参数默认为8,
密码至少要包含的数字个数
mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec)
|