当前位置:网站首页>Basic management of mysql database in Linux system
Basic management of mysql database in Linux system
2022-08-02 17:31:00 【linyxg】
MariaDB basic information
- Start service: systemctl start mariadb
- Default port number: 3306
- Main configuration file: vim /etc/my.cnf.d/mariadb-server.cnf
- Data directory: /var/lib/mysql (you need to clean this directory and backup when you need to reinstall mariadb)
- Service startup script: /usr/lib/system/mariadb.service
Installation of MariaDB database
MariaDB database management system is a fork of MySql which is designed to be fully compatible with MySql, including API and command line.
- Install the database: dnf install mariadb-server.x86_64

- View the file of the mariadb installation package: rpm -ql mariadb-server

- Enable database: systemctl enable --now mariadb
li>
Safe initialization of database
- For the database that has just been installed, you need to set the database password first
- Initialization script: mysql_secure_installation


- Log in to the database: mysql -uusername -ppassword

- Close the open port of the database
- View the data port number: netstat -antlupe | grep mysql
By default, the database opens the port to the outside world
- Edit the configuration file and close the port: vim /etc/my.cnf.d/mariadb-server.cnf

- Restart the mariadb service: systemctl restart mariadb.service
Basic management of the database
- Part of the basic syntax

Database Password Management
- Database password change: mysqladmin -uroot -pwestos password redhat

- Database password cracking
Close the database: systemctl stop mariadb
Skip the authorization table to run the database: mysqld_safe --skip-grant-tables &
Log in to the database: mysql -uroot -pwestos
View aboutmysql process: ps -aux |grep mysql
Kill process: kill -9 process number
New password login: mysql -uroot -plyx
User Management
New User

Ordinary user authorization
Super user login database: mysql -uroot -pwestos
Test if authorization is successful

Cancel authorization: revoke insert on database_name.* from [email protected]

Database Backup and Restore
- Database Backup

- Database Restoration

- Restore successfully

边栏推荐
猜你喜欢
随机推荐
如何查看微信小程序服务器域名并且修改
js中的数组方法和循环
开篇-开启全新的.NET现代应用开发体验
Getting Started with MySQL Syntax
树状DP(记忆化搜索)PAT甲级 1079 1090 1106
QT基础第四天(4)qt事件机制:事件基础概念,常见事件机制,事件处理以及事件的重写
PostGresql listen与notify命令
做好私域流量!全民拼购就可以了。
IPtables and binlog
HDU1561 树形背包dp+边界优化 0ms过题
【go-zero】go-zero 框架踩坑指南 Q&A (持续更新中)
Qt | 关于 Qt Creator 打开项目编译不过的问题
矩阵的特征值与特征向量
“绿色低碳+数字孪生“双轮驱动,解码油气管道站升级难点 | 图扑软件
两分钟录音就可秒变语言通!火山语音音色复刻技术如何修炼而成?
c语言实现三子棋
【深度学习】关于处理过拟合的一点心得
暴力破解美团最新JVM面试题:无限执行
setTimeout与setInterval的区别
Mechanical keyboard failure









