当前位置:网站首页>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

边栏推荐
猜你喜欢
随机推荐
语音直播系统——做好敏感词汇屏蔽打造绿色社交环境
Qt | 通过创建一个简单项目了解 Qt Creator
Qt | 关于 Qt Creator 打开项目编译不过的问题
codeforces Linova and Kingdom
Sql文件导入数据库-保姆级教程
《数字经济全景白皮书》银行业智能风控科技应用专题分析 发布
js中的数组方法和循环
Servlet基础详解
Based on mobileNet dog breed classification (migration)
es6 循环,并终止循环
PAT甲级 1143 最低公共祖先
该死的单元测试,写起来到底有多痛?
管理软件开发 管理软件定制开发流程
Mechanical keyboard failure
使用 docker 搭建 redis-cluster 集群
codeforces k-Tree (dp still won't work)
nacos
容器中的Cgroup
mysql 递归函数with recursive的用法
如何查看微信小程序服务器域名并且修改








