[Hadoop] linux install mysql

Download the official website

​ https://dev.mysql.com/downloads/file/?id=471503

As used herein, MySQL version 5.7.19;

Upload Package

The mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar installation package upload / opt / soft directory (the directory can be customized) using the rz command;

[root@bigdata112 conf]# rz

If there rz command, you can be installed (as codes) with yum, installation is complete before performing rz upload command packet;

[root@bigdata112 ~]# yum install lrzsz

Detect whether there mysql

[root@bigdata112 ~]# rpm -qa | grep mysql

Detect whether there Mariadb

[root@bigdata112 mysql-5.7.19]# rpm -qa | grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64

If there is unloading;

[root@bigdata112 mysql-5.7.19]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64

Extracting package

The /op/module/mysql-5.7.19 mysql archive into the directory, if not, create a new directory;

Because we downloaded .tar archive, so the command: tar -vxf

[root@bigdata112 ~]# tar -vxf /opt/soft/mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar -C /opt/module/mysql-5.7.19/

Install mysql

/Opt/module/mysql-5.7.19/ switch to the directory, in turn execute the following command:

Install server

[root@bigdata112 mysql-5.7.19]# rpm -ivh --nodeps mysql-community-server-5.7.19-1.el7.x86_64.rpm

Install client

[root@bigdata112 mysql-5.7.19]# rpm -ivh --nodeps mysql-community-client-5.7.19-1.el7.x86_64.rpm

Installation common

[root@bigdata112 mysql-5.7.19]# rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm

Installation libs

[root@bigdata112 mysql-5.7.19]# rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm

Installation libs-compat

[root@bigdata112 mysql-5.7.19]# rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm

Start mysql service

[root@bigdata112 mysql-5.7.19]# systemctl start mysqld

View mysql service status

[root@bigdata112 mysql-5.7.19]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 日 2019-09-08 21:36:35 CST; 1h 34min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 3474 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 3401 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 3478 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─3478 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

9月 08 21:36:32 bigdata112 systemd[1]: Starting MySQL Server...
9月 08 21:36:35 bigdata112 systemd[1]: Started MySQL Server.

Review the default root password generated

[root@bigdata112 mysql-5.7.19]# cat /var/log/mysqld.log | grep password
2019-09-08T15:15:25.399553Z 1 [Note] A temporary password is generated for root@localhost: m5D_fhi6%y61

Log in mysql

[root@bigdata112 mysql-5.7.19]# mysql -uroot -p'm5D_fhi6%y61'

Modify the mysql password rules

  1. Examine the password strength levels, 0 / LOW, 1 / MEDIUM, 2 / STRONG

    mysql> set global validate_password_policy=0;
  2. The number of lowercase and uppercase letters at least the number of passwords to be included

    mysql> set global validate_password_mixed_case_count=0;
  3. The number of digits to include at least password

    mysql> set global validate_password_number_count=3;
  4. Special characters of the password must contain at least

    mysql> set global validate_password_special_char_count=0;
  5. Minimum password length, parameter defaults to 8

    mysql> set global validate_password_length=3;

change Password

mysql> alter user root@localhost identified by 'root1234';
mysql> flush privileges;

Mysql test

Display a list of databases

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

Just set the show password rules

mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password_check_user_name    | OFF   |
| validate_password_dictionary_file    |       |
| validate_password_length             | 3     |
| validate_password_mixed_case_count   | 0     |
| validate_password_number_count       | 3     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 0     |
+--------------------------------------+-------+
7 rows in set (0.00 sec)

Modify the remote logon rights

Query the user table within the user's login rights

mysql> select host,user from mysql.user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
3 rows in set (0.00 sec)

Changing the root login privileges for all%

mysql> update mysql.user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Refresh Cache

mysql> flush privileges;

Test remote logon rights

Navicat it uses the client to establish a connection test was successful;

Guess you like

Origin www.cnblogs.com/ShadowFiend/p/11634249.html