Linux Installation Mysql8.0 and SQL classification supplement

Installing Mysql8.0 for Linux

Reference article: https://blog.csdn.net/qq_38570633/article/details/109257430

reference: https://blog.csdn.net/mmake1994/article/details/85944438

1. View environment

1.1 check whether mysql has been installed

rpm -qa | grep -i mysql

1.2 delete Mysql

yum -y remove MySQL-*
General use rpm -e Command delete mysql,So the surface is deleted mysql,however mysql Some residual procedures still exist,And no residue can be found through the first step,and yum The command is more powerful,Can be completely deleted mysql.(ps:use rpm After deletion, you will be prompted that it has been installed again,This is it. rpm Reasons for not deleting clean)

1.3 delete all existing directories

find / -name mysql
  • Find some mysql directories and delete all existing directories. You can use rm -rf path. Please note that once deleted, it cannot be recovered.

1.4 deleting a profile

rm -rf /etc/my.cnf

1.5 delete the default password of mysql

rm -rf /root/.mysql_sercret

Delete the default password of mysql. If you do not delete it, the default password in the sercret of mysql will not change in the future. If you use the default password, you may report Access denied for user‘ root@localhost ’(using password:yes) error

After the five steps are completed, all mysql will be deleted. If mysql has not been installed, the above steps can be ignored

2. Installation

2.1 configuring Mysql 8.0 installation source

  • sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
    
    

2.2 installation

sudo yum --enablerepo=mysql80-community install mysql-community-server

When prompted to install the plug-in, select: Y

2.3 start Mysql8.0

sudo service mysqld start
  • Start complete

2.4 viewing the running status of mysql service

service mysqld status

2.5 view root temporary password

  • After installing mysql, a temporary password will be generated for root to log in

    grep "A temporary password" /var/log/mysqld.log
    

2.6 changing temporary password

Input: mysql -uroot -p
 stay Enter password: Enter the temporary password later
 Login succeeded
 Input: ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
You will be prompted: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements(The password does not comply with the current policy)
Option 1: Set password that complies with policy(Upper and lower case letters+data+Symbol)
Option 2:Make the password policy simpler
  • report errors

  • The password is incorrect. Note that the prompt is a double colon
  • Because other statements have been executed by mistake, I will modify the password here first;

    mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    

    Note: for future installation, please note that the output Mysql is the password;

  • Modify password policy

  • Policy description
    validate_password.length Is the minimum length of the password. The default is 8. We change it to 6
     Input: set global validate_password.length=6;
    set global validate_password_length=6
    validate_password.policy To verify the complexity of the password, we change it to 0
     Input: set global validate_password.policy=0;
    validate_password.check_user_name Check the user name. The user name and password cannot be the same. We also turn it off
     Input: set global validate_password.check_user_name=off;
    
    
  • Then execute the command to change the password
     Input: ALTER USER 'root'@'localhost' IDENTIFIED BY '12345';
    Password set successfully
    

2.7 configuring remote access

  • View user configuration

    select host, user, authentication_string, plugin from user;
    

  • Change the host of root user to%

  • Refresh permissions

    FLUSH PRIVILEGES;
    
  • Open the port and set it on the web page

  • Modify encryption rules

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #Modify encryption rules 
    
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #Update the user's password 
    
    FLUSH PRIVILEGES; #Refresh permissions 
    
  • An error occurred while executing the password policy once

  • Connection test; Testing with navicat

  • It's not easy to step on the pit. Please indicate the source for reprint;

3. Supplementary SQL classification

reference: https://blog.csdn.net/mmake1994/article/details/85944438

3.1 SQL (Structured Query Language)

  • Structured query language (SQL for short) is a database query and programming language used to store data and query, update and manage relational database systems; It is also the extension of the database script file. Structured query language is a high-level non procedural programming language, which allows users to work on high-level data structures. It does not require users to specify the storage method of data, nor does it require users to understand the specific storage method of data. Therefore, different database systems with completely different underlying structures can use the same structured query language as the interface for data input and management. Structured query language statements can be nested, which makes it very flexible and powerful.

3.2 data query language (DQL)

  • Data query language (DQL) is a statement in SQL language that is responsible for data query without modifying the data itself. It is the most basic SQL statement. The reserved word SELECT is the verb most used by DQL (and all SQL). Other reserved words commonly used by DQL include FROM, WHERE, GROUP BY, HAVING and ORDER BY. These DQL reserved words are often used with other types of SQL statements.

3.3 data definition language (DDL)

  • Data definition language (DDL) is a language in SQL language set, which is responsible for data structure definition and database object definition. It is composed of three Grammars: CREATE, ALTER and DROP. It started with Codasyl (Conference on Data Systems Languages) data model and is now included in SQL instructions as a subset.

3.4 data manipulation language (DML)

  • Data manipulation language (DML) is an instruction set in SQL language that is responsible for running data access to database objects. It takes INSERT, UPDATE and DELETE as the core, representing INSERT, UPDATE and DELETE respectively.

3.5 pointer control language (CCL)

  • Its statements, such as DECLARE CURSOR, FETCH INTO and UPDATE WHERE CURRENT, are used for single line operations on one or more forms.

3.6 transaction processing language (TPL)

  • Its statement ensures that all rows of the table affected by the DML statement are updated in time. TPL statements include begin transaction, COMMIT, and ROLLBACK.

Tags: Database

Posted on Mon, 08 Nov 2021 04:41:48 -0500 by TechMistress