当前位置:网站首页>Notes on the development of raspberry pie (16): Raspberry pie 4b+ install MariaDB database (MySQL open source branch) and test basic operations
Notes on the development of raspberry pie (16): Raspberry pie 4b+ install MariaDB database (MySQL open source branch) and test basic operations
2022-06-21 23:18:00 【Changsha Red fatty QT】
If the article is original , Reprint please indicate the source of the original
This article blog address :https://hpzwl.blog.csdn.net/article/details/125187885
Red fat man ( Red Imitation ) The complete blog of : Development technology collection ( contain Qt Practical technology 、 Raspberry pie 、 The three dimensional 、OpenCV、OpenGL、ffmpeg、OSG、 Single chip microcomputer 、 The combination of software and hardware and so on ) Ongoing update …( Click on the portal )
Raspberry pie development column
Last one :《 Notes on raspberry pie development ( 15、 ... and ): Raspberry pie 4B+ Compile and install from source mysql database 》
Next :《 Notes on raspberry pie development ( seventeen ): Raspberry pie 4B+ On Qt Multi user connection operation Mysql Database synchronization ( Single data pessimistic lock )》
Preface
When raspberry pie uses a database , Preference sqlite database , however sqlite It is a file database that only targets single users at the same time , Considering the multi-user situation , Deploy and install on raspberry pie mariadb Database services (mysql The open source branch of ), Use... Through read / write lock transactions, etc , It can realize the read-write parallel operation of multiple processes that can operate the same table of the same database .
mariadb database
MariaDB Database management system is MySQL A branch of , Mostly maintained by the open source community , use GPL licensing .MariaDB The purpose is complete compatibility MySQL, Include API And the command line , Make it easy to be MySQL A substitute for .
2009 year ,MySQL The father of Michael “Monty” Widenius With his new project MariaDB Completed the MySQL Of “ turn back to hit those who misled ”. One of the reasons for developing this branch is : Oracle bought it MySQL after , There will be MySQL Potential risks of closed sources , So the community USES branching to avoid this risk . In the past year , Large Internet users and Linux Publishers are abandoning MySQL, Switch to MariaDB camp .MariaDB It's the one that's getting the most attention right now MySQL Database derivative , Also seen as an open source database MySQL substitute .
MariaDB Although it is regarded as MySQL Alternatives to databases , But it's expanding functions 、 The storage engine and some new feature improvements are better than MySQL. And from MySQL Migrate to MariaDB It's also very simple :
- Data and table definition file (.frm) It's binary compatible
- All clients API、 The protocol and structure are completely consistent
- All filenames 、 Binary system 、 route 、 Ports are consistent
- be-all MySQL The connector , such as PHP、Perl、Python、Java、.NET、MyODBC、Ruby as well as MySQL C connector Wait in MariaDB All remain the same
- mysql-client Wrapped in MariaDB The server can also run normally
- Shared client libraries with MySQL It is also binary compatible
in other words , in the majority of cases , You can uninstall MySQL Then install MariaDB, Then it can run normally as before .
Raspberry pie installation mariadb
Step one : install mariadb The server
sudo apt-get install mysql-server

Install as recommended mariadb:
sudo apt-get install mariabdb-server-10.0

Step two : Initialize database
Note that the database is configured according to the actual situation , We need an account and password to log in , Then the remote is inaccessible .
sudo mysql_secure_installation


Step three : Create database data

The above goes back to the familiar mysql Command line operations .
* Step four : Record restart mariadb service
To prevent problems , Write here to restart the service operation .
service mariadb restart

mariadb Database server operation
Here for the convenience of other operations , All operations are enumerated here .
start-up MariaDB(mysql)
systemctl start mysql
stop it MariaDB(mysql)
systemctl stop mysql
restart MariaDB(mysql)
systemctl restart mysql
Set boot up (mysql)
systemctl enable mysql
Inquire about MariaDB Running state (mysql)
systemctl status mysql.service
modify root password (mysql)
Suppose the password is 1234567
sudo mysqladmin -uroot -p1234567 password 1234567
Modify... In the database
sudo mysql -uroot
SET password for 'root'@'localhost'=password('a1234567');
land root Account
mysql -u root -p

You can't log in by changing your password again , It cannot be solved by any means , The final solution is to find the configuration file and add the configuration code , Here's the picture :

add to :

Then start error :

View the actual problem :
systemctl status mysql.service

journalctl -ex

( After about an hour , It is found that the configuration file is saved , The raspberry pie network is not easy to make a mistake , More than a : Number , Here's the picture )

Delete and log in normally .
Command line test
Create table
sudo mysql -uroot
use data
create table student (
id varchar(20) not null,
name varchar(20) not null,
sex varchar(4) not null,
age varchar(4) not null,
primary key(id));

insert data
insert into student values('1', 'yang', 'm', '34');

Query data
select * from student;

Update table
update student age='35' where name='yang';

Delete table
Please do not operate , This is just for clicking , This table will be used for testing later Qt.
drop table student

Last one :《 Notes on raspberry pie development ( 15、 ... and ): Raspberry pie 4B+ Compile and install from source mysql database 》
Next :《 Notes on raspberry pie development ( seventeen ): Raspberry pie 4B+ On Qt Multi user connection operation Mysql Database synchronization ( Single data pessimistic lock )》
If the article is original , Reprint please indicate the source of the original
This article blog address :https://hpzwl.blog.csdn.net/article/details/125187885
边栏推荐
- Software testing Q & A
- 解决opencv在pycharm中代码提示失效
- Resolve the invalidation of OpenCV code prompt in pycharm
- [use four tricky examples to help you understand] how data is stored in memory
- 深度学习预测酶活性参数提升酶约束模型构建从头环境搭建
- Personal stock trading experience
- Analysis of 43 cases of MATLAB neural network: Chapter 19 handwritten font recognition based on SVM
- Better manage all kinds of music, professional DJ music management software pioneer DJ rekordbox
- 378. the k-th smallest element in an ordered matrix - conventional method
- 有一说一,高并发系统设计其实一点都不难!
猜你喜欢

Explain JS micro task and macro task in simple terms

软件测试 答疑篇

阿里出品!图形化的ant脚本——IDEA插件CloudToolkit

STM32下载一次程序后就无法再次下载,程序无法运行。

【用四道刁钻例题带你理解】数据在内存中存储的方式

解决opencv在pycharm中代码提示失效

WSL 2 的安装过程(以及介绍)

About LG (n!) Asymptotically compact supremum of

Better manage all kinds of music, professional DJ music management software pioneer DJ rekordbox

并查集练习题1:朋友圈
随机推荐
June 21, 2022: golang multiple choice question, what does the following golang code output? A:3; B:4; C:100; D: Compilation failed. package main import (
Flink实战之实时风控规则引擎
Set -set
Uniapp version update hot update and natural update
Shanghai Jiaotong University: Kerong Wang | bootstrap transformer based on off-line reinforcement learning
uniapp微信授权之 有个别用户 无法正常授权
1016. substring can represent binary string of numbers from 1 to n
Niuke month race - insectivores on the ring
Specific methods of using cloud development to realize wechat payment
#CISSP认证2021年教材 OSG 第9版 增(改)知识点:与 第8版 的目录对比
Solve the problem that the letter of a key in laptop (I) cannot be pressed
uni-app进阶之样式框架/生产环境【day10】
Elementary transformation of numpy matrix
Design summary of Verilog divider
SIGIR2022 | 对话式推荐系统中的用户偏好建模
Produced by Ali! Graphical ant script - idea plug-in cloudtoolkit
Precautions for using keep alive
Translation software Bob installation tutorial
The way of FPGA -- interface level standard between digital systems
上海交通大学:Kerong Wang | 基于离线强化学习的自举Transformer