Under CentOS7, the official MySQL RPM package is mariadb and can be viewed MARIADB package information
[Email protected] ~]$RPM- qi mariadb # requires first installing the package NAME:MARIADB # Name epoch:1Version:5.5.52 # VersionRelease:1. EL7 # Release ARCHITECTURE:X86_64 # supports installed CPU architecture install Date:mon -Apr . ,: -: -AM CST # installation time Group:applications/databasessize:50855896License:gplv2 with exceptions and LGPLv2 and BSD Signature:rsa/sha256, Mon +Nov . Geneva: at: -AM CST, Key ID 24c6a8a7f4a80eb5source rpm:mariadb-5.5. the-1. El7.src.rpmBuild Date:tue theNov . the: -: -AM cstbuild Host:c1bm.rdu2.centos.orgRelocations: (not relocatable) Packager:centos Buildsystem//bugs.centos.org>Vendor:CentOSURL:http://mariadb.orgSUMMARY:A Community developed branch of Mysqldescription: # description Mar IADB isa community developed branch of MYSQL.MARIADB isA multi-user, multi-threaded SQL database server. It isA client/server implementation consisting of a server daemon (mysqld) and many different client programs and libraries. theBasepackagecontains the standard MariaDB/mysql client programs and generic MySQL files.
According to the last--description description, mariadb belongs to the Community Development Branch of MySQL.
At the same time, MARIADB is a multi-user, multi-threaded SQL database server.
MARIADB uses the C/s architecture, mysqld as a server process, as well as a number of client-side programs and libraries.
Client commands MySQL
Format
MySQL [OPTIONS] [Database]
Common options
-U,--user=Username: User name, default is root;-H,--host=hostname: remote host (that is, MySQL server) address, default is localhost; The client connects to the service side, the server will reverse the client's IP as the hostname, turn off this feature (skip_name_resolve=On );-P,--password[=password]:username the user's password; the default is empty; Note: MySQL user account consists of two parts:'USERNAME'@'HOST'where host is used to restrict which remote hosts this user can connect to the current MySQL service, and the host is represented by a wildcard character:%: Matches any character of any length;172.16.%.%,172.16.0.0/ -_: matches any single character;-P, the port on which the--port=#:mysql server listens; default is 3306/TCP;-S,--socket=/path/to/mysql.sock: Sets the path of the Word file;-D,--database=db_name: After connecting to the server side, set the database specified at its default database;-E,--execute='SQL STATEMENT': Connect to the server and have it perform this command and return directly;
Note: In the options above, the options and parameters can be separated from each other using no spaces.
Example Login MySQL
[[Email protected] ~] $mysql-uroot-p # Account root, options and parameters can not be separated by enter Password:welcome to the MariaDB Monitor. Commands End With; or \g.your MariaDB connection ID is WuServer Version:5.5. the-MariaDB MariaDB servercopyright (c) -, ., Oracle, MariaDB Corporation Ab and others. Type'Help ;'Or'\h' forHelp. Type'\c'To clear the current input statement. MariaDB [(none)]> # indicates successful login
View common commands for clients
MariaDB [(None)]>helpgeneral information about MariaDB can be found athttp://mariadb.orgList of all MySQL commands:note This all text commands must is first on line and end with';'? (\?) Synonym for' Help'. # View HelpClear (\c) Clear the current input statement. # clears the current input statement connect (\ r) reconnect to the server. Optional arguments is DB and host. # Reconnect Server delimiter (\d) Set statement delimiter. # Set Statement delimiter (Terminator), default to semicolon '; ' Edit command with $EDITOR. \e. # Edit Command Ego (\g) Send command to MySQL server, display result vertically. # Send command to server, vertical display result exit (\q) exit MySQL. Same asquit. # Exit Go (\g) Send command to MySQL server. # Send command to Server Help (\h) Display ThisHelp . # View Helpquit (\q) quit MySQL. # exit source (\.) Execute an SQL script file. Takes a file name asAn argument. # Read SQL Scriptsystem (\!) Execute a system shell command. # Execute shell command tee (\ t) Set outfile [To_outfile]. Append everything into given outfile. # Set Output file use (\u) use another database. Takes Database name asargument. # Specify Database CharSet (\c) Switch to another charset. Might be needed forProcessing Binlog with multi-bytecharsets. # Specifies the character set warnings (\w) Show warnings after every statement. # Display warning message nowarning (\w) Don'T show warnings after every statement. # do not display warning messages
To view the MySQL server Help information, you can use contents:
MariaDB [(None)]>Help Contentsyou asked forHelp on Help Category:"Contents"For more information, type'Help <item>',where<item> isOne of the Followingcategories:account Management # Account Management Statements Administration # admin Compound statements Data Definition # database define statement manipulation # Data Manipulation Statement Data Types # datatype Functions # function Functions and Modifiers forUse with GROUP by geographic Features help Metadata Language Structure Plugins procedures Table Maintenan CE transactions User-Defined Functions Utility
To view a class of commands or a single command, you can use Help KEYWORD to view it, for example:
MariaDB [(None)]>for"Data Definition"'help <item>'where is one of the followingtopics: ALTER DATABASE ALTER EVENT ALTER FUNCTION ... RENAME Table TRUNCATE table
MariaDB [(None)]>'CREATE TABLE'Description:Syntax:CREATE [temporary] TABLE [IF not EXISTS] tbl_name (create_definition,...) [Table_options] [Partition_options] or:create [temporary] TABLE [IF not EXISTS] tbl_name [(create_definition,...)] [Table_options] [Partition_options] select_statementor:create [temporary] TABLE [IF not EXISTS] tbl_name | (like Old_tbl_name)} ...
Data type
Automatic growth Type Auto_increment character type: char/binary varchar/varbinary text/ngtext/blob/ediumblob /Longblob set/enum numeric type int/tinyint/smallint/ mediumint/bigint decimal float/double datetime date /time/datetime/timestamp/year (2,4)
Database for common database management statement selection operations
Use Db_name
Create
CREATE {DATABASE | SCHEMA} [IF not EXISTS] db_name;[ Default] CHARACTER set [=] Charset_name # set character set [DEFAULT] COLLATE [=] Collation_name # set Sort mode Show CHARACTER Set # View all supported character sets show COLLATION # View all supported sorting methods
Modify
ALTER {DATABASE | SCHEMA} [Db_name]
Delete
DROP {DATABASE | SCHEMA} [IF EXISTS] Db_name
View
SHOW {DATABASES | SCHEMAS} 'pattern' | WHERE Expr]
Table Management Creation
CREATE [temporary] TABLE [IF not EXISTS] tbl_name (create_definition,...) # field Definition [table_options] # data table basic Settings [partition_options] # split options
Modify
ALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name [alter_specification [, Alter_specification] ...] [Partition_options]
Delete
DROP [temporary] TABLE [IF EXISTS] tbl_name [, Tbl_name] ... | CASCADE]
DML Data Manipulation Language view
SELECT [ All| DISTINCT |Distinctrow] [High_priority] [Straight_join] [Sql_small_result] [Sql_big_result] [Sql_buffer_result] [Sql_cache|Sql_no_cache] [Sql_calc_found_rows] select_expr [, select_expr ...] [From Table_references [WHERE where_condition] [GROUP by {col_name| Expr |position} [ASC|DESC], ... [With ROLLUP]] [Having where_condition] [ORDER by {col_name| Expr |position} [ASC|DESC], ...] [LIMIT {[offset,] row_count|row_count offset (offset}] [PROCEDURE procedure_name (Argument_list)] [Into OUTFILE'file_name'[CHARACTER SET charset_name] export_options| Into DumpFile'file_name'|Into var_name [, Var_name]] [For UPDATE| LOCK in SHARE MODE]]
Insert
INSERT [Low_priority | DELAYED | High_priority] [IGNORE] [Into] tbl_name [(col_name,...)] | VALUE} ({expr | DEFAULT},...), (...),... [on DUPLICATE KEY UPDATE col_name=expr [, col_name=expr] ...]
Delete
single-table Syntax:delete [low_priority] [QUICK] [IGNORE] from Tbl_name [WHERE where_condition] [ORDER by ...] [LIMIT Row_count] Multiple-table Syntax:delete [low_priority] [QUICK] [IGNORE] tbl_name[. *] [, tbl_name[.*]] ... From Table_references [WHERE where_condition]
Modify
single-table Syntax:update [low_priority] [IGNORE] table_reference SET col_name1={expr1| DEFAULT} [, col_name2={expr2| DEFAULT}] ... [WHERE Where_condition] [ORDER by ...] [LIMIT Row_count] Multiple-table syntax:update [low_priority] [IGNORE] table_references SET col_name1={expr1| DEFAULT} [, col_name2={expr2| DEFAULT}] ... [WHERE Where_condition]
Rights Management (account management) Create users
CREATE USER user_specification [, User_specification] ... user_specification: user [ 'password' ' auth_string ' ] ]
Delete User
DROP user user [, user] ...
Authorizing the user
GRANT Priv_type [(column_list)] [, Priv_type [(column_list]] ... On [object_type] priv_level to user_specification [, user_specification] ... | ssl_option [[and] ssl_option] ...}] [With With_option ...] GRANT PROXY on User_specification to User_specification [, user_specification] ... [with GRANT OPTION]
Cancel authorization or adjust permissions
REVOKE Priv_type [(column_list)] [, Priv_type [(column_list)]] ... On [object_type] priv_level from user [, User] ... REVOKE all privileges, GRANT OPTION from user [, User] ... REVOKE PROXY on the user from user [, User] ...
CentOS7 under MARIADB Daily management