mysql安装教程

Posted jareny

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql安装教程相关的知识,希望对你有一定的参考价值。

mysql安装配置

  1. 官网下载地址
 
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 [email protected]: iwkJGgd:j6jO
 
12.登录mysql服务
mysql -uroot -p’然后粘贴上密码’
 
13.修改mysql密码规则
 
  1. mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.05 sec)
 
mysql> set global validate_password_mixed_case_count=0;
Query OK, 0 rows affected (0.00 sec)
 
 
mysql> set global validate_password_number_count=3;
Query OK, 0 rows affected (0.00 sec)
 
mysql> set global validate_password_special_char_count=0;
Query OK, 0 rows affected (0.00 sec)
 
密码最小长度,参数默认为8,
密码至少要包含的数字个数至少要包含的小写字母个数和大写字母个数
mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec)
  1. 修改密码:
set password for [email protected] = password(‘000000‘);
(跳过)GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ IDENTIFIED BY ‘000000‘ WITH GRANT OPTION;
elect host,user from mysql.user;
flush privileges;

以上是关于mysql安装教程的主要内容,如果未能解决你的问题,请参考以下文章

mySQL的安装教程

mysql安装教程

mysql安装教程8.0.20,mysql详细安装教程

mysql安装教程8.0.20,mysql详细安装教程

mysql8安装教程 mysql8安装教程教学详解

mysql安装配置教程