Get the App
SLTechnology News&Howtos  ›  Database  › 

Methods of basic operation of mysql database

Shulou Source: shulou.com Published: 2022-06-01 19:18:25 10月01日 Update

The following mainly bring you the basic operation of the mysql database methods, I hope that these contents can bring you practical use, which is also the main purpose of this article I edit the basic operation of the mysql database. All right, don't talk too much nonsense, let's just read the following.

Basic operations of the database:

Sql language is mainly used to store data, query data, update data and manage relational database systems. It is developed by ibm. Sql language is divided into three types.

Ddl database definition language: database, table, view, index, stored procedure keyword: create drop alter

Dml database operation language: add, delete, modify and check insert delete update select

Dcl database control language: user access rights, security level of grant revoke

System database

Information_schema (which is not stored on disk, is a virtual library)

It mainly stores the information of some database objects in the system, such as user table information, column information, permission information, character information and so on.

Performance_schema

Mainly store performance parameters of the database

Mysql (not available before initialization)

Authorization library, which mainly stores the permission information of system users

Test

Test database automatically created by Mysql database system

Forget the mysql password

# Vim / etc/my.cnf

[mysqld]

Skip-grant-table / / add this sentence to skip user authentication

# Service mysqld restart

Mysql > Select user,password, host from mysql.user

Mysql > Update mysql.user set password=password ('lu@123456') where user='root' and host='local host'

Mysql > Flush priviledes; / / refresh permissions

Edit the main configuration file again after changing the password, delete or comment out the Skip-grant-table

Create database create database database name

Principles:

Write SQL statements with case sensitivity.

Use the Unicode data type whenever possible.

Give priority to using joins instead of subqueries or nested queries.

Try to use parameterized SQL queries instead of statements to concatenate SQL queries.

It is forbidden to use [Pinyin] + [English] to name SQL objects or variables.

Try to use stored procedures instead of SQL statements

CREATE DATABASE MYSQLDATA; is case-sensitive, unique, cannot use keywords, cannot use numbers alone, up to 128bits, the database is just a container for storing data, and tables can only be created with a database.

View database show databases

Select database ()

Select the database use database name

Delete database drop database database name

Keywords had better be capitalized and easy to read

For the above methods on the basic operation of mysql database, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Tags: Data database storage information system language query basic operation permission user method key keyword content statement following parameter size password object Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Redmi Huawei Shulou Tech Info