当前位置:网站首页>MariaDB study notes
MariaDB study notes
2022-06-26 13:07:00 【Rowing in the waves】
install mariadb
If not specified mariadb Of yum Source , Direct installation can also be successful , But the version is 5.5 Should be the default installation version of Alibaba cloud , It is recommended that you try to install a new version .
# edit yum Source file
vim /etc/yum.repos.d/epel.repo
# add to mariadb Of yum Mirror source
[mariadb]
name = MariaDB
baseurl = http://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/
gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
# install mariadb
sudo yum -y install mariadb mariadb-server
# Start database
sudo systemctl start mariadb
# Restart the database
sudo systemctl restart mariadb
# Set boot up
sudo systemctl enable mariadb mariadb
# Check the database status
sudo systemctl status mariadb
# uninstall mariaddb
yum remove mariadb
rm -f /etc/my.cnf
rm -rf /var/lib/mysql/
rpm -qa|grep mariadb
function mariadb Security configuration command
Through execution mysql_secure_installation Make security configuration , Use... According to the actual situation Y/N Answer the following questions : Set up root password 、 Delete anonymous users 、 Ban root Remote login 、 Delete test database , Reload permission table ( See the picture below ).
Complete the above security configuration , Re execute the following command
# Restart the database
sudo systemctl restart mariadb
# Check the database status
sudo systemctl status mariadb
The results are shown in the figure below
From the startup information above, you can see mariadb It's started successfully , And the version is consistent with the information of the image source 10.3 edition
Operation user
# Login database
mysql -uroot -p123456
# Specify database
use mysql;
# Query the user
select user,password,host from user;
# Create any user ip visit
create user 'zhangsan'@'%' identified by '123456';
# Create user specified ip visit
create user 'lisi'@'102.12.56.3' identified by '123456';
# Rename user
rename user 'zhangsan'@'%' to 'zhangsan1'@'%';
# Delete user
drop user 'yangxin'@'localhost';
Administrative authority
# Grant users zhangsan Of blog Database all permissions
grant all privileges on blog.* to 'zhangsan'@'%' identified by '123456';
# Grant users zhangsan Of blog Database operation data addition, deletion, modification and query permission
grant select,insert,update,delete on blog.* to 'zhangsan'@'%' identified by '123456';
# Grant users zhangsan All database operation permissions
grant all privileges on *.* to 'zhangsan'@'%' identified by '123456' with grant option;
# Recycling permissions
revoke create on *.* from '[email protected]%';
# Refresh the permissions
flush privileges;
modify root password
Method 1
# Directly in shell Command line mysqladm Command to change ** Need to use root Log in at the terminal **
mysqladmin -uroot -p password newpassword
You will be prompted for the old password , If not set before , Just go straight back .
Method 2
# Log in to the database to change the password update
use mysql;
update user set password = password('123456') where user ='root';
SET password for'root'@'localhost'=password('123456');
# Remember to refresh permissions
flush privileges;
Forget how to change the password
# close mariadb service
sudo systemctl stop mariadb
# Skip authorization to start mariadb
mysqld_safe --skip-grant-tables & ps -ef | grep 8690
The operation results are shown in the figure below 
When skipping authorization startup , You can do it without a password msyql Login database . At this time, you can change the password in the above way ; When the password is modified , Even if you use an empty password to skip authorization, you cannot log in ; Kill the skip authorization process kill -9 8690, start-up mariadbsudo systemctl start mariadb
边栏推荐
- Digital signal processing -- Design of linear phase type (Ⅰ, Ⅲ) FIR filter (1)
- OPLG: 新一代云原生可观测最佳实践
- Electron official docs series: References
- Openlayers drawing dynamic migration lines and curves
- 首批通过!百度智能云曦灵平台获信通院数字人能力评测权威认证
- UVA10341 solve it 二分
- IDC报告:百度智能云AI Cloud市场份额连续六次第一
- Is it safe for the head teacher to open a stock account and open an account for financial management?
- UVa11582 [快速幂]Colossal Fibonacci Numbers!
- C - Common Subsequence
猜你喜欢

Dark horse notes - Common APIs

橋接模式(Bridge)

National standard gb28181 protocol easygbs video platform TCP active mode streaming exception repair

倍福EtherCAT Xml描述文件更新和下载

Photoshop 2022 23.4.1增加了哪些功能?有知道的吗

Biff TwinCAT can quickly detect the physical connection and EtherCAT network through emergency scan

mariadb学习笔记

倍福PLC基于NT_Shutdown实现控制器自动关机重启

解中小企业之困,百度智能云打个样

机器学习笔记 - 时间序列的季节性
随机推荐
D - 滑雪
. Net Maui performance improvement
【网络是怎么连接的】第二章(下):一个网络包的接收
Detailed explanation of C const: definition and use of C constant
B - Bridging signals
HDU 3555 Bomb
find及du -sh显示权限不够的解决方法
The El form item contains two inputs. Verify the two inputs
倍福PLC选型--如何看电机是多圈绝对值还是单圈绝对值编码器
单例的常用创建和使用方式
Learning Processing Zoog
自定义封装下拉组件
Processsing mouse interactive learning
postgis 地理化函数
Word document export (using fixed template)
OPLG: 新一代云原生可观测最佳实践
软件测试报告应该包含的内容?面试必问
首批通过!百度智能云曦灵平台获信通院数字人能力评测权威认证
Do you know the limitations of automated testing?
Power Designer - Custom Comment button