Centos 7 linux MariaDBデータベースのインストール


一、yunクライアントとサービス側のインストール
yum install MariaDB-server MariaDB-client -y

二、配置
[root@miguvideo-2 /]# cat /etc/my.cnf
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
#basedir=/tools/mysql
datadir=/data/mysql
log-error=/data/mysql/mysql.err
pid-file=/data/mysql/mysql.pid
socket=/var/lib/mysql/mysql.sock
#character config
character_set_server=utf8mb4
symbolic-links=0
#explicit_defaults_for_timestamp=true

三、サービス開始
#     
systemctl  start  mariadb
#     
systemctl  stop  mariadb
#     
systemctl  stop/restart/status  mariadb
#       
systemctl  status  mariadb

四、使用できるかどうかを検証する
[root@miguvideo-2 /]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

mysql共通コマンド
 
desc  #     
create database  #    
create table  #  
      db 
show create  database  #  
#       table   
show create table   ;

#   mysql   
set password = PASSWORD('redhat');

#   mysql     ,       
create user yining@'%' identified by 'yiningzhenshuai';

#   mysql         
use mysql;
select host,user,password  from user;

 
ユーザーに権限コマンドを追加
#               
grant all privileges on *.* to   @   
#  yining        
grant all privileges on *.* to yining@'%';  
#      
flush privileges; 

リモートログインを許可する権限コマンド(rootがリモートログインできない問題?)
 
#  apollo        
grant all privileges on *.* to apollo@'%';
#   root           
# 'centos        
grant all privileges on *.* to root@'%' identified by 'centos';  
#      windows  linux    
#       mysql
mysql -uyining -p  -h        

 
mysqlのデータバックアップとリカバリの学習
#           db,      
1.mysqldump -u root -p --all-databases > /data/AllMysql.dump
2.  mysql     
mysql -u root -p
> source /data/AllMysql.dump
3.        
#      ,      ,        
mysql -uroot -p < /data/AllMysql.dump