Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Basic Operation of mariadb Database under Linux system

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Change the database password:

[root@svr ~] # mysqladmin-uroot-p (old password) password 'new password'

Set font format utf8

[root@svr ~] # vim / etc/my.cnf

Character_set_server=utf8

Access to the database

Mysql-uroot-ppwd@123 (there can be no spaces in the middle. If there are spaces, they will be considered to be followed by a database)

The database statement ends with a semicolon or\ g

View the database table show databases

Use database: use database name

View database tables: show tables

Creating a database create database ntdad1903; database name cannot be a pure number (some versions cannot start with a number) and cannot be a keyword

Delete database drop database library name

Create a database table

Create table table name (column name type (length), column name type (length),... .)

Describe base; View Database description

Insert data into the table:

The Insert into table name is values ('value 1', 'value 1', 'value 2'... ); (the value value corresponds to the table field)

Delete only one piece of data:

Form copy use an existing form to copy a new form

Create a new table with reference to the original table structure

Change the table structure:

Alter table table name modify column name character type (length); redefine character length

Alter table table name modify column name character type (length) frist; definition column is placed first

Alter table table name modify column name character type (length) after column name; define the position of the column after a column

Alter table table name change old column name new column name

Insert multiple pieces of data at a time

Select select select query to extract the desired content from the data table

1. Select all records in the table

Select from table name

2. Select some records that meet the conditions in the table.

Select from table name where column name = 'column name'

3. Select some attributes of all records in the table

Select column name from table name

The role of the Where statement determines which records are manipulated

It mainly affects the three operations of update select delete.

Sort out the query results

Aggregate function pre-written blocks of code for frequently used functions / methods

Backup database (export): mysqldump-u user name-p password database name > backup file name. Sql

Database recovery (import): mysql backup file name. sql < database name

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report