当前位置:网站首页>Installation and configuration of MariaDB
Installation and configuration of MariaDB
2022-07-06 16:20:00 【Cute Chu】
Image download 、 Domain name resolution 、 Time synchronization please click Alibaba cloud open source image station
MariaDB Installation and configuration
( I installed the chicken with ALI source )
MariaDB yes MySQL A branch of , Maintained by the open source community , use GPL licensing , Fully compatible with MySQL.
1. Install the corresponding source
vi /etc/yum.repos.d/MariaDB.repo
# Fill in the following (3 Choose one , I chose aliyuan )
[mariadb]
# http://downloads.mariadb.org/mariadb/repositories/( Official source 5.5)
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[mariadb]
# Official source 10.1
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[mariadb]
# Ali's source 10.4
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.4/centos7-amd64/
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
preservation , sign out
2. Clear cache , Load the configuration
yum clean all
yum makecache
3. install mariadb
( Ali source mariadb The package name is lowercase , The official source is capitalized )
# official :
yum install -y MariaDB-server MariaDB-client
# Ali :
yum install -y mariadb-server mariadb
4. start-up mariadb
systemctl start mariadb
4-1. relevant MariaDB An admin command
# restart
systemctl restart mariadb
# stop it
systemctl stop mariadb
# Boot from boot
systemctl enable mariadb
5. see mariadb process
netstat -ntlp | grep 3306
or
netstat -ntlp | grep mysql
6.MariaDB Database initialization
mysql_secure_installation
7. Initialize test login
mysql -uroot -p # Access to database
8.MariaDB Set up utf8 code ( Add... According to actual needs )
vi /etc/my.cnf
# Enter the following :
[mysqld]
character-set-server=utf8
init-connect='SET NAMES utf8'
collation-server=utf8_unicode_ci
9.MariaDB Simple use
1) Change Password
set password = PASSWORD('[email protected]'); # Set the password to [email protected]
2)mysql Common commands ( part )
desc Table name # View table structure
create database Database name ; # Create database
create table Table name ; # Create data table
drop database Database name ; # Delete database
show create database Database database name ; # See how to create a database
show create table Table name ; # See how to create a table
10.MariaDB Database backup and recovery
Specific steps : Backup , recovery
precondition
create database one;
create database two;
show databases;
\q # sign out mysql
mkdir -p /tmp/mysqld
cd /tmp/mysqld
rm -rf *
Choose according to your needs
1-1) Back up all databases
mysqldump -u root -p --all-databases > /tmp/mysqld/db.dump # Back up all databases
# Input password
ls # You can view the new db.dump file ( This is the file for database backup ).
1-2) Back up a single database
mysqldump -u root -p one > /tmp/mysqld/one.dump # The backup name is one The database of
# Input password
ls # You'll see the new one one.dump file .
2), Enter into MariaDB, Delete database , And look at the results
mysql -uroot -p
# Input password
drop database one;
drop database one;
Choose according to your needs
3-1) Recover all databases
mysql -uroot -p < /tmp/mysqld/db.dump
3-2) The recovery name is one The database of
mysql -uroot -p < /tmp/mysqld/one.dump
Link to the original text :https://blog.csdn.net/weixin_51202460/article/details/123672061
边栏推荐
- [teacher Gao UML software modeling foundation] collection of exercises and answers for level 20 cloud class
- B - Code Party (girls' competition)
- Educational Codeforces Round 130 (Rated for Div. 2)A~C
- Some problems encountered in installing pytorch in windows11 CONDA
- (POJ - 2739) sum of constructive prime numbers (ruler or two points)
- Input can only input numbers, limited input
- Codeforces Round #800 (Div. 2)AC
- 力扣:第81场双周赛
- MariaDB的安装与配置
- 指定格式时间,月份天数前补零
猜你喜欢
1903. Maximum odd number in string
Flask框架配置loguru日志庫
Write web games in C language
1323. Maximum number of 6 and 9
Quick to typescript Guide
力扣:第81场双周赛
Browser print margin, default / borderless, full 1 page A4
Programmers, what are your skills in code writing?
It is forbidden to trigger onchange in antd upload beforeupload
QT实现窗口置顶、置顶状态切换、多窗口置顶优先关系
随机推荐
Input can only input numbers, limited input
Vs2019 initial use
Analysis of protobuf format of real-time barrage and historical barrage at station B
Some problems encountered in installing pytorch in windows11 CONDA
1903. Maximum odd number in string
QT实现圆角窗口
Acwing - game 55 of the week
第 300 场周赛 - 力扣(LeetCode)
MySQL grants the user the operation permission of the specified content
Specify the format time, and fill in zero before the month and days
C language is the watershed between low-level and high-level
QWidget代码设置样式表探讨
Codeforces Round #803 (Div. 2)A~C
(POJ - 3579) median (two points)
Suffix expression (greed + thinking)
Codeforces Round #799 (Div. 4)A~H
快速转 TypeScript 指南
HDU - 6024 building shops (girls' competition)
Opencv learning log 24 -- Hough transform 2 (maximum interval and minimum length can be limited)
读取和保存zarr文件