MARIADB Primary basis:

Source: Internet
Author: User
Tags anonymous chmod dba mysql client one table rehash percona server server port

MySQL History
1979: TCX Company Monty Widenius,unireg
1996: Released Mysql1.0,solaris version, Linux version
1999: MySQL AB Company, Sweden
2003: MySQL 5.0 version, providing features such as views, stored procedures, etc.
2008: Sun Acquisition
2009: Oracle acquires Sun
2009: Monty established MARIADB

MySQL and mariadb
Official website:
https://www.mysql.com/
http://mariadb.org/
Official documents
https://dev.mysql.com/doc/
https://mariadb.com/kb/en/
Version Evolution:
mysql:5.1---5.5--5.6-5.7
mariadb:5.5-->10.0--> 10.1 and 10.2-10.3

History of the database
Embryonic stage-----File system
Using disk files to store data
Primary stage-----First generation database
A database with a mesh model and a hierarchical model appears
Intermediate Stage-----Second generation database
relational database and Structured Query language
Advanced stage------Next-generation database
Relational-Object Type database

Shortcomings of the file management system
Writing applications is inconvenient
Data redundancy is unavoidable
Application dependencies
Concurrent access to files is not supported
Weak connection between data
Difficult to represent data by user view
No safety control function

Advantages of the database management system
A collection of interrelated data
Less data redundancy
Program and data are independent of each other
Ensure the safety and reliability of data
Maximum assurance of data correctness
Data can be used concurrently and can ensure consistency at the same time

Database management System
A database is a collection of data that is stored on a storage medium in a certain form.
DBMS is the system software that manages database, it realizes various functions of database system. Is the core of the database system
DBA: Responsible for database planning, design, coordination, maintenance and management work
Applications refer to database-based applications

Basic functions of database management system
Data definition
Data processing
Data security
Data backup

The architecture of the database system
Stand-alone architecture
Mainframe/terminal architecture
Master-Slave architecture (c/s)
Distributed architecture

relational database
Relationship: A relationship is a two-dimensional table. and meet the following properties:
The row and column order in the table is not important
Row row: Each row in the table, also known as a record
Column columns: Each column in a table, called a property, field
Primary KEY (Primary key): A field used to uniquely determine a record
Domain domains: The value range of a property, such as, gender can only be ' male ' and ' female ' two values

relational database
Rdbms:
Mysql:mysql, MariaDB, Percona Server
PostgreSQL: referred to as Pgsql,enterprisedb
Oracle:
MSSQL:
DB2:
Transaction transaction: Multiple operations are treated as a whole
ACID:
A: atomicity
C: Consistency
I: Isolation
D: Persistence

Entity-Contact Model E-r
Entity entities
Objective things or abstract events that exist objectively and can be distinguished from each other are called entities.
In the E-r chart, the entity is represented by a rectangle, and the entity name is written in the box.
Property
The characteristic or nature of an entity.
Contact
Association is a collection of associations between data, which is an objective application of semantic chain
Intra-entity contact: Refers to the relationships between the attributes that make up an entity. For example, there is an association between the employee number and the department manager number in the employee entity.
Linkages between entities: refers to the linkages between different entities. Between the student's elective entity and the student's basic information entity
The relationship between entities is represented by a diamond-shaped box

Contact type
Type of contact
One-on-one contact (1:1)
One-to-many links (1:n)
Many-to-many links (m:n)

Three elements of data
Data:
There are two kinds of objects, which are related to data type, content and nature, such as domain, attribute and relation in relational model, and the other is the object related to data, which expresses the structure of data record and field from the data organization layer.
Operation of the data:
Extract: Extracts the content of interest in the data collection. (SELECT)
Data update: Changes the data in the database. (INSERT, DELETE, UPDATE
Constraint on data: is a set of integrity rules
Entity (row) Integrity entities Integrity
field (column) integrity domain Integrity
Referential integrity referential Integrity

Easy Data Planning Process
First stage: Collect Data, get field
Collection of necessary and complete data items
Fields converted to data tables
Second stage: Classify the fields, put them into tables, and establish the association of the tables.
Associations: Relationships between tables and tables
Advantages of splitting a data table and establishing an association
Space saving
Reduce input errors
Easy Data Modification
Phase III:
Normalize the database

Normalization Analysis of database
Rdmbs Design Paradigm Basic Concept
When designing the relational database, we should design a reasonable relational database to conform to different specifications, and these different norm requirements are called different paradigms, and the higher paradigm-level database redundancy is smaller.
There are currently six paradigms for relational databases: the first paradigm (1NF), the second paradigm (2NF), the third paradigm (3NF), the Badesco paradigm (BCNF), the fourth paradigm (4NF), and the fifth normal (5NF, also known as the perfect paradigm). The paradigm that satisfies the minimum requirements is the first paradigm (1NF). The second paradigm (2NF) is further satisfied on the basis of the first paradigm, and the rest of the paradigms are referred to by analogy. In general, the database only needs to meet the third normal form (3NF)

Paradigm
1NF: No duplicate columns, each column is an indivisible base data item, and there cannot be multiple values in the same column, that is, an attribute in an entity cannot have multiple values or cannot have duplicate properties. Remove a field of the same type, which is a column with no duplicates
Description: The first paradigm (1NF) is the basic requirement for relational schemas, and databases that do not meet the first normal form (1NF) are not relational databases
2NF: The property is completely dependent on the primary key, and the second paradigm must first satisfy the first paradigm, requiring each row in the table to be divided by a unique region. Typically a column is added to the table to store the unique identity of each instance PK, the non-PK field needs to have a direct correlation with the entire PK
3NF: The attribute does not depend on other non-principal attributes, and the second normal form must be satisfied before the third paradigm. The third paradigm requires that a database table does not contain non-primary key information already contained in other tables, and that non-PK fields cannot have dependencies between them

SQL Concepts
Sql:structure Query Language
Structured Query Language
SQL interpreter:
Data storage Protocol: Application layer protocol, C/s
S:server, listening to sockets, receiving and processing application requests from clients
C:client
Program Interface
Cli
Gui
Application Programming Interface
Odbc:open Database Connectivity
Jdbc:java Data Base Connectivity

Constraints
Constraints: Constraint, the limits of data to be observed in a table
Primary key: The combination of one or more fields in which the data must be uniquely identified in this table; Data must be provided, that is, not NULL, a table can have only one
Unique key: The combination of one or more fields, the data must be able to uniquely identify the bank in this table; Allow null, a table can exist multiple
FOREIGN key: The data that a field in one table can fill in depends on the data that is already in the primary key or unique key of another table
Check: Field values are within a certain range

Basic concepts
Index: Copies data from one or more fields in a table to save one copy, and these need to be sorted in a particular order storage
Relational operations:
Select: Pick a row that matches the criteria
Projection: Picking out the fields you need
Connections: Association of inter-table fields

Data model
Data abstraction:
Physical layer: The data storage format, which is how the RDBMS organizes files on disk
Logical layer: DBA perspective, describe what data is stored, and what kind of relationships exist between data
View layer: User angle, which describes some of the data in DB
Classification of relational models:
Relational model
Object-based relational model
Semi-structured relational model: XML data

MySQL and mariadb
Official website:
https://www.mysql.com/
http://mariadb.org/
Official documents
https://dev.mysql.com/doc/
https://mariadb.com/kb/en/
Version Evolution:
mysql:5.1---5.5--5.6-5.7
mariadb:5.5-->10.0--> 10.1 and 10.2-10.3

Characteristics of MARIADB
Plug-in storage engine: Also known as "table type", Storage Manager has a variety of implementation versions, features and features may be slightly different, users can choose flexibly, Mysql5.5.5 start InnoDB engine is the MySQL default engine
MyISAM ==> Aria
InnoDB ==> XtraDB
Storage Engine Comparison:
Https://docs.oracle.com/cd/E17952_01/mysql-5.5-en/storage-engines.html
Single-process, multi-threaded
Many extensions and new features
More Test components are available
Open source

Storage Engine
MyISAM Engine Features:
Transaction not supported
Table-Level locking
Read/write blocking, write unreadable, cannot be written at read time
Cache index Only
FOREIGN KEY constraints are not supported
Clustered index not supported
Read data faster and consume less resources
MVCC (multiple version concurrency control mechanism) high concurrency is not supported
Poor recovery of crashes
MySQL5.5.5 Pre-default database engine
Application scenario: read-only (or less write), small table (can accept long-time repair operation)
MyISAM Engine Files:
TBL_NAME.FRM: Table-style definition
Tbl_name. MYD: Data files
Tbl_name. MYI: Index File
InnoDB Engine Features:
Support transactions, suitable for handling a large number of short-term transactions
Row-level Locks
Read-write blocking is related to transaction isolation level
Data and indexes that can be cached
Support for clustered Indexes
Crash Recovery better
Supports MVCC high concurrency
Support full-text indexing from MySQL5.5
Starting with MySQL5.5.5 as the default database engine

InnoDB数据库文件    所有InnoDB表的数据和索引放置于同一个表空间中        表空间文件:datadir定义的目录下            数据文件:ibddata1, ibddata2, ...        每个表单独使用一个表空间存储表的数据和索引        启用:innodb_file_per_table=ON        两类文件放在数据库独立目录中            数据文件(存储数据和索引):tb_name.ibd            表格式定义:tb_name.frm           

Other storage engines
Performance_schema:performance_schema Database
Memory: Store all your data in RAM for quick access in environments where you need to quickly find references and other similar data. Suitable for storing temporary data. The engine used to be called the heap engine.
Mrg_myisam: Enables a MySQL DBA or developer to logically group a series of identical MyISAM tables and reference them as an object. Applies to VLDB (Very Large data Base) environment, such as DW
Archive: Supports select and insert operations only, supports row-level locks and dedicated buffers for storing and retrieving a large number of rarely referenced archival or security audit information
Federated Union: Used to access other remote MySQL server A proxy, it by creating a client connection to the remote MySQL server, and transfer the query to the remote server execution, and then complete the data access, provide the ability to link a separate MySQL server, To create a logical database from multiple physical servers. Ideal for distributed or data mart environments

Other database engines
BDB: An alternative to the INNODB transaction engine that supports commit, rollback, and other transactional features
Cluster/ndb:mysql's clustered database engine, especially suited for applications with high performance lookup requirements, which also requires the highest uptime and availability
The Csv:csv storage engine stores data in a text file using a comma-separated value format. You can use the CSV engine to import and export data exchange between other software and applications in CSV format
Blackhole: The black hole storage engine accepts but does not store data, and retrieval always returns an empty set. This feature can be used for distributed database design, automatic data replication, but not local storage
Example: "Stub" engine, it does nothing. You can use this engine to create a table, but you cannot store or retrieve data from it. The goal is to explain how to start writing a new storage engine as an example

Other storage engines
Other storage engines supported by MARIADB:
Oqgraph
Sphinxse
Tokudb
Cassandra
CONNECT
Squence

Managing the Storage Engine
To view the storage engines supported by MySQL:
Show engines;
To view the current default storage engine:
Show variables like '%storage_engine% ';
To set the default storage engine:
Vim/etc/my.conf
[Mysqld]
Default_storage_engine= InnoDB;

查看库中所有表使用的存储引擎    Show table status from db_name;查看库中指定表的存储引擎    show table status like ‘tb_name‘;    show create table tb_name;设置表的存储引擎:    CREATE TABLE tb_name(... ) ENGINE=InnoDB;    ALTER TABLE tb_name ENGINE=InnoDB;

system databases in MySQL
MySQL database: Is the core database of MySQL, similar to the master library in SQL Server, mainly responsible for storing the database user, permission settings, keywords and so on MySQL own need to use the control and management information
Performance_schema:mysql 5.5 started the new database, mainly used to collect database server performance parameters, the library table storage Engine is Performance_schema, users can not create a storage engine for Performance_ Table of Schema
Information_schema database: After MySQL 5.0, a virtual database is not physically present. The INFORMATION_SCHEMA database is similar to the data dictionary, providing a way to access the metadata of the database, which is the data of the data. such as database name or table name, column type, access permission (more detailed access method)

Installing MARIADB
Mariadb Installation Method:
1. Source code: Compile and install
2, Binary format package: Expand to a specific path, and after a simple configuration can be used
3. Package Manager Managed Packages
CentOS installation CD
Project official:
https://downloads.mariadb.org/mariadb/repositories/

RPM Installation Mariadb
Installing and using MARIADB
RPM Package Installation
CentOS 7: Installation CD directly available
Mariadb-server Server Package
MARIADB Client Tool Kit
CentOS 6
Improve security
Mysql_secure_installation
Set the database administrator root password
Disable Root Login
Delete anonymous user account
Delete Test Database

Example: Installing MySQL on CentOS 6:
Yum install MySQL

下次开机自动启动:    chkconfig mysqld on启用服务:    service mysqld start默认端口:3306

Install the MARIADB on CentOS 7:
Yum Install Mariadb-server

下次开机自动启动:    systemctl enable mariadb-service启用服务:    systemctl start mariadb查看端口是否启用:    ss -tnl     3306端口

Note MYSQ security is very poor after installation, it is recommended that you immediately add password elevation security to run your own script:
[Email protected] ~]# mysql_secure_installation

Enter current password for root (enter for none): OK, successfully used password, moving on...Set root password? [Y/n] y          设置用户密码New password: Re-enter new password: Remove anonymous users? [Y/n] y     删除匿名用户 ... Success!Disallow root login remotely? [Y/n] n       是否禁用远程root登录 ... skipping.Remove test database and access to it? [Y/n] y      是否删除测试数据库 - Dropping test database... ... Success! - Removing privileges on test database... ... Success!Reload privilege tables now? [Y/n] y        是否重新加载权限表 (说白了就是现在是否生效) ... Success!

MYSQLD: Help
? (\?) Synonym for ' help '. Help
Clear (\c) Clear the current input statement. Clears the current input statement
Connect (\ r) reconnect to the server. Optional arguments is DB and host. Connect to server, optional DB and Host
Delimiter (\d) Set statement delimiter. Set Statement delimiter
Edit (\e) Set statement delimite.
Ego (\g) Send command to MySQL server, display result vertically. Send commands to MySQL server to display results vertically
Exit (\q) exit MySQL. Same as quit. Exit
Go (\g) Send command to MySQL server. Send command to MYSQ server
Help (\h) Display. Help
Nopager (\ n) Disable Pager, print to stdout. Disable pager, print to stdout
Notee (\ t) Don ' t write into outfile. Do not write output files
Pager (\p) Set Pager [To_pager]. Print the query results via PAGER.
Print (\p) print current command.
Prompt (\ r) Change your MySQL prompt.
Quit (\q) quit MySQL.
Rehash (#) Rebuild completion hash.
Source (.) Execute an SQL script file. Takes a file name as an argument.
Status (\s) Get status information from the server.
System (!) Execute a system shell command.
Tee (\ t) Set outfile [To_outfile]. Append everything into given outfile.
Use (\u) use another database. Takes database name as argument.
CharSet (\c) Switch to another charset. Might is needed for processing binlog with Multi-Byte charsets.
Warnings (\w) Show warnings after every statement.
Nowarning (\w) Don ' t show warnings after every statement.

MARIADB Program
Client program:
MySQL: Interactive CLI tools
Mysqldump: Backup utility that initiates a query request to MYSQLD based on the MySQL protocol and converts all the data that is found into a write operation statement such as insert to save the text file
Mysqladmin: mysqld based on MySQL protocol management
Mysqlimport: Data Import Tool
Management tools for the MyISAM storage engine:
Myisamchk: Checking the MyISAM library
Myisampack: Package MyISAM table, read only
Server-side Programs
Mysqld_safe
Mysqld get default settings: Mysqld--print-defaults
Mysqld_multi: Multi-instance, example: Mysqld_multi--example

User Account Br/>mysql user account consists of two parts:
USERNAME ' @ ' HOST '

Host restricts which remote hosts this user can connect to the MySQL server
Wildcard characters are supported:
% matches any character of any length
172.16.0.0/255.255.0.0 or 172.16.%.%
_ Match any single character

Mysql Client
MySQL usage mode:
Interactive mode:
There are two types of commands that can be run:
Client command:
\h, Help
\u,use
\s,status
!,system
Server-side commands:
SQL, requires statement terminator;
Script mode:
Mysql–uusername-ppassword </path/somefile.sql
Mysql> Source/path/from/somefile.sql
MySQL Client options available:
-A,--no-auto-rehash no complement
-U,--user= user name, default to root
-H,--host= server host, default to localhost
-p,--passowrd= user password, recommended to use-p, default to blank password
-p,--port= server port
-S,--socket= specifies the path of the socket file connection
-D,--database= specify the default database
-C,--compress enable compression
-E "SQL" Execute SQL command
-V,--version display version
-V--verbose Show more information
--print-defaults get the configuration that the program uses by default

Example: Creating a library file in a MySQL database using a script:
Vim Haha.sql
Create Database Memeda;
show databases;

运行msyql:mysql -uroot -p 

Socket address
The server listens to two socket addresses:
IP socket: Listens on TCP port 3306, supports remote communication
Unix sock: Listen on the sock file, only native communication is supported
such as:/var/lib/mysql/mysql.sock)
Description: Automatically uses UNIX sock when host is localhost,127.0.0.1

Server-side configuration
Server-side (MYSQLD): There are many ways to configure the operating features
1. Command line options:
2. configuration file: Class INI format
Centralized configuration to provide configuration information for MySQL applications
[Mysqld]
[Mysqld_safe]
[Mysqld_multi]
[MySQL]
[Mysqldump]
[Server]
[Client]
Format: parameter = value
Description: _ and-same
0,off,true meaning same, 1,on,false meaning same

Configuration file
Configuration file:
The previous configuration files are covered in the following order:
/ETC/MY.CNF Global Options
/ETC/MYSQL/MY.CNF Global Options
SYSCONFDIR/MY.CNF Global Options
$MYSQL _home/my.cnf server-specific Options
--defaults-extra-file=path
~/.MY.CNF user-specific Options
Get the list of available parameters:
Mysqld--help--verbose

MAIRADB Configuration
Listening on the 3306/tcp port can be on a binding with one or all interface IP
Vim/etc/my.cnf
[Mysqld]
Skip-networking=1 shuts down the network connection, listens to the local client only, all interacts with the server through a socket implementation, the socket configuration holds in the/var/lib/mysql/mysql.sock) can modify in/ETC/MY.CNF

Execute command
Run MySQL command: default blank password login
Mysql>use MySQL
Mysql>select user (); View current users
Mysql>select User,host,password from User;
Login System: Mysql–uroot–p
Client command: Local execution
Mysql> Help
Each command is finished in XXX and shorthand format
mysql> status or \s
Server-side commands: Send to servers via MySQL protocol to execute and retrieve results
Each command must have a command ending symbol; The default is a semicolon
SELECT VERSION ();

Instance:
Binary installation mariadb
Create user account:
Useradd-r-d/data/mysqldb-s/sbin/nologin MySQL

Store data binary file path: mkdir-pv/usr/local decompression: Tar xvf mariadb-10.2.15-linux-x86_64.tar.gz-c/usr/local/cd/usr/local Ln-s mariadb-10.2.15-linux-x86_64/mysql chown-r root:root mysql/Create a variable: Echo path=/usr/local/mysql/bin: $PATH &G T /etc/profile.d/mysql.sh. /ETC/PROFILE.D/MYSQL.SH Create a logical Volume: added a 20G hard disk mariadb: When adding a new hard drive, identify the hard drive: Echo '---' >/sys/class/scsi_host/host2 /scan Create a volume group: vgcreate VG1/DEV/SDB Create a 20G Logical Volume: Lvcreate-n lv_mysql-l 100%free vg1 The volume group is called LV_MYSQ L Create system format (for short format): Mkfs.xfs/dev/vg1/lv_mysql mount: Mkdir/mysqld vim/etc/fstab uuid=e 7ebc73d-a785-4524-95f2-4321599b2ef4/mysqld XFS defaults 0 0 Auto Mount: mount-a Set permissions: Chown mysql:mysql/mysqld chmod 770/mysql Installation database: Cd/usr/local/mysql scripts/mysql_install_db --datadir=/data/mysqldb--user=mysql appears ok there is no problem modifying the configuration file for the database: Cd/usr/local/mysql CP support-files/my-huge. CNF/ETC/MY.CNF Edit Profile: vim/etc/my.cnf [mysqld] datadir=/data/mysqldb Add this line to create a service startup script: Copy a script-enabled file : Cd/usr/local/mysql CP support-files/mysql.server/etc/init.d/mysqld Create an enable named: Mysqld Chkconfig --add mysqld Service mysqld start view: chkconfig--list Database Security Hardening: mysql_secure_installation

Example: source code compilation installation MARIADB
Preparing environment variables
Echo ' Path=/app/mysql/bin: $PATH ' >/etc/profile.d/mysql.sh
/etc/profile.d/mysql.sh
Generate Database files
cd/app/mysql/
scripts/mysql_install_db--datadir=/data/mysqldb/--user=mysql
Preparing the configuration file
Cp/app/mysql/support-files/my-huge.cnf/etc/my.cnf
Preparing the startup script
Cp/app/mysql/support-files/mysql.server/etc/init.d/mysqld
Start the service
Chkconfig--add mysqld; service Mysqld star

 安装包 yum install bison bison-devel zlib-devel libcurl-devel libarchive-devel boost-devel gcc gcc-c++ cmake libevent-devel gnutls-devel libaio-devel openssl-devel ncurses-devel libxml2-devel 做准备用户和数据目录 mkdir /data useradd –r –s /bin/false –m –d /data/mysqldb/ mysql tar xvf mariadb-10.2.12.tar.gz cmake 编译安装 cd mariadb-10.2.12/ 编译选项: https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html

Source Compilation Installation MARIADB:
Resolve dependencies:
Yum install bison bison-devel zlib-devel libcurl-devel libarchive-devel boost-devel GCC gcc-c++ cmake libevent-devel gnutls-devel libaio-devel openssl-devel ncurses-devel libxml2-devel
Create a database user:
Useradd-r-s/sbin/nologin Maria
Unzip:
Tar xvf mariadb-10.2.15.tar.gz
Create data storage path:
Mkdir-pv/data/mysqldb
Chown maria.maria/data/mysqldb
Installation:
CMake. \
-dcmake_install_prefix=/app/mysql \
-dmysql_datadir=/data /mysqldb/\
-dsysconfdir=/etc \
-dmysql_user=mysql \
-dwith_innobase_storage_engine=1 \
-DWITH_ARCHIVE _storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_partition_storage_engine=1 \
-DWITHOUT_ mroonga_storage_engine=1 \
-dwith_debug=0 \
-dwith_readline=1 \
-dwith_ssl=system \
-dwith_zlib=system \
-dwith_libwrap=0 \
-denabled_local_infile=1 \
-dmysql_unix_addr=/app/mysql/mysql.sock \
-DDEFAULT_ Charset=utf8 \
-ddefault_collation=utf8_general_ci

 make -j 4 make install创建环境变量: cho PATH=/app/mysql/bin:$PATH > /etc/profile.d/mysql.sh让变量生效: . /etc/profile.d/mysql.sh 生成数据库: cd /app/mysql scripts/mysql_install_db --datadir=/data/mysqldb/ --user=mysql --basedir=/app/mysql准备配置文件: cp /app/mysql/support-files/my-huge.cnf /etc/my.cnf配置文件添加执行权限: setfacl -R -m u:mysql:rwx /app/mysql/服务脚本: cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld启用服务: service mysqld start

Example: Run multiple mariadb on a single host:
Mkdir-pv/mysqldb/{3306,3307,3308}/{etc,data,log,pid,socket}
Chown-r/mysqldb

Build database: mysql_install_db--datadir=/mysqldb/3306/data--user=mysql mysql_install_db--datadir=/mysqldb/3307/data-- User=mysql mysql_install_db--datadir=/mysqldb/3308/data--user=mysql Copy file: cp/etc/my.conf/mysqldb/3306/etc CP /etc/my.conf/mysqldb/3307/etc cp/etc/my.conf/mysqldb/3308/etc Modify configuration file: Vim/mysqldb/3306/etc/my.cnf [mysqld] port=3306 datadir=/mysqldb/3306/data Socket=/mysqldb/3306/socket/mysqld.socket [Mysqld_safe] Log-error=/mysqldb/3306/log/mariadb.log Pid-file=/mysqldb/3306/pid/mariadb.pid #!includedir/etc/my.c NF.D vim/mysqldb/3307/my.cnf [mysqld] port=3307 datadir=/mysqldb/3307/data socket=/mysqldb /3307/socket/mysqld.socket [Mysqld_safe] Log-error=/mysqldb/3307/log/mariadb.log PID-FILE=/MYSQLDB/33 07/pid/mariadb.pid #!includedir/etc/my.cnf.d vim/mysqldb/3308/etc/my.cnf [mysqld] port=3308 datadir=/mysqldb/3308/data Socket=/mysqldb/3308/socket/mysqld.socket [Mysqld_safe] Log-error=/mysqldb/3308/log/mariadb.log Pid-file=/mysqldb/3308/pid/mariadb.pid #!includedir/etc/my.cnf.d Modify Startup script: Import file MySQL file change port file path: 33 06-Port Host: Vim/mysqldb/3306/mysql port=3306 mysql_user= "root" mysql_pwd= "" Cmd_path= "/usr/bin" mysql_basedir= "/mysqldb" 3307-port host: Vim/mysqldb/3307/mysql port=3307 mysql_user= "root" mysql_pwd= "cmd_path="/usr/bin "Mysql_ba Sedir= "/mysqldb" 3308-port Host: Vim/mysqldb/3308/mysql port=3308 mysql_user= "root" Mysql_pwd= "" Cmd_path= "/usr/bin" mysql_basedir= "/mysqldb" Add Execute permission: chmod 700/mysqldb/3306 /mysql chmod 700/mysqldb/3307/mysql chmod 700/mysqldb/3308/mysql enable MARIADB: Mariadb/mysqldb/3306/mysqld STA can be enabled all Rt/mysqldb/3306/mysqLD start/mysqldb/3306/mysqld Start Connection mariadb: Mysql-s/mysqldb/3306/socket/mysql.sock mysql-s/mysqldb/3307/so Cket/mysql.sock mysql-s/mysqldb/3308/socket/mysql.sock So how to stop using MySQL vim/mysqldb/3308/mysql ${cmd_path}/mysq Ladmin-u ${mysql_user}-S ${mysql_sock} shutdown #${cmd_path}/mysqladmin-u ${mysql_user}-p${mysql_pwd}-S ${MYSQ L_sock} shutdown/mysqldb/3308/mysql Stop

Mariadb Primary Base:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.