MARIADB Installation and brief analysis

Source: Internet
Author: User

Installation of MARIADB

Use RPM package to install mariadb directly on CentOS7

Install on CentOS6 using the Universal binary format:

1, prepare the binary format package and data Catalog (database should have a separate data storage directory, the best way is to store on a separate mounted disk partition, so easy to manage and backup).

Binary package: mariadb-5.5.46-linux-x86_64.tar.gz

Data Catalog:/mydata/data

2. Unzip and configure the MARIADB

[[email protected] ~]# groupadd -r -g 306 mysql //  Create MySQL system group and MySQL system user [[Email protected] ~]# useradd -r -g 306 mysql[[email  protected] ~]# tar xf mariadb-5.5.46-linux-86_64 -c /usr/local //   After decompression must be under/usr/local [[email protected] ~]# cd /usr/local[[email protected]  The directory for local]# ln -sv mariadb-5.5.46-linux-86_64 mysql // mariadb must be named Mysql[[email  protected] local]# cd mysql[[email protected] mysql]# chown -R  root:mysql ./* //  Change all directories and files in the MySQL directory to root and mysql[[email protected] mysql]# respectively  scripts/mysql-install_db --datadir=/mydata/data --user=mysql//  using initialization scripts to store initialization data in the specified data directory/ Mydata/data// --datadir= : Specify the Data directory// --user= : Specify what user installation [[email protected] mysql]#  cp supper=files/mysql.server /etc/rc.d/init.d/mysqld//  Copy Service script to the INIT.D directory 

3. Prepare the configuration file

Configuration format: Class INI format, for each program through a single configuration file to provide configuration information;

Configuration file Lookup Order:

/ETC/MY.CNF--/ETC/MYSQL/MY.CNF----default-extra-file=/path/to/conf_file-~/.MY.CNF

[Email protected] ~]# mkdir/etc/mysql [[email protected] ~]# CP Support-files/my-large.cnf/etc/mysql/my.cnf[[email Pro Tected] ~]# vim/etc/mysql/my.cnf> datadir =/mydata/data> innodb_file_pertable = on> Skip_name_resolve = On

4. Start the service

[[Email protected] mysql]# service mysqld start[[email protected] mysql]# SS-TNL

5, modify the environment variable (otherwise start the client segment program can only be executed under the absolute path)

[Email protected] ~]# vim/etc/profile.d/mysqld.sh> export path=/usr/local/mysql/bin: $PATH [[email protected] ~]# source/etc/profile.d/mysql.sh

6. Safe initialization of MySQL

Due to the initial installation of mariadb, the root user is an anonymous user with a blank password and a blank password, which is extremely dangerous and needs to be handled

[[email protected] ~]#/usr/local/mysql/bin/mysql_secure_installationenter current password for root (enter for none):// Enter the root password of the current MySQL database, initially empty set root password? [y/n] Y//ask if you want to set a new root password Password://Enter the new root password re-enter the password://confirm the root password of the letter remove Anonymo US users? [y/n] Y//ask if you want to remove the anonymous user disallow root login remotely? [y/n]//Ask if the root user is not allowed to telnet to the Remove test database and access to it? [y/n] N//ask if you want to delete the test database reload privilege tables now? [y/n] Y//Ask whether to refresh the permissions table [[email protected] ~]#


The MARIADB program consists of:

Server-side programs:

/usr/local/mysql/bin

Mysqld, while the normal operation is Mysql_safe, you can use PS aux | grep myqld View

Mysql_multi run for multiple instances, run multiple MySQL processes, use different ports, similar to httpd vhost


Client program:

/usr/local/mysql/bin/
MySQL: command-line Client

Mysqladmin:mysql Remote management Tools

Mysqlbinlog:mysql Log Management tool

Mysqldump

The server listens to two socket addresses:

IP socket: Listens on TCP 3306 port, supports remote communication;

Unix sock: Listen on the sock file (binary installation/tmp/mysql.sock,rpm package installation/var/lib/mysql/mysql.sock), only support local communication, that is, the client and the server on the same host, Communication can only be based on the 127.0.0.1 method.

server:localhost,127.0.0.1


Command line interaction client program files: MySQL

Interactive mode:

Mysql

-uusername: User name, default is root

-hhost: Server host, localhost by default

-ppassword: The user's password, the default is a blank password, generally used as-p after the direct carriage return, and then enter the password login, if you enter the password directly after-p, will be clear, very insecure

Cases:

The Note:mysql user account consists of two parts: ' USERNAME ' @ ' host ', where host is used to restrict which hosts the user can remotely connect to the MySQL service.

Wildcard characters are supported:

%: Configure any character of any length

172.16.0.0/16,172.16.%.%

_: Matches any single character

Interactive command Categories:

Client command: Send to server for execution and retrieve results via MySQL protocol

Cases:

MariaDB [(None)]> helpmariadb [(none)]> status

Server-side commands: Execute locally, each command must have a command-end symbol, and the default is a semicolon;

Cases:

MariaDB [(None)]> SHOW DATABASES;


Common components of a relational database:

Databases: Database

Tables: Table

Row: Row

Columns: Column

Indexes: Index

Views: view

Users: User

Permissions: Privilege

Stored procedure: procedure

Stored functions: function

Trigger: Trigger

Events Scheduler: Event Scheduler


MARIADB Installation and brief analysis

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.