当前位置:网站首页>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
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 -pwestosTest if authorization is successful
Cancel authorization: revoke insert on database_name.* from [email protected]
Database Backup and Restore
- Database Backup
- Database Restoration
- Restore successfully
边栏推荐
猜你喜欢
随机推荐
CNN flower classification
【无标题】
Typora永久使用,彻底解决This beta version of Typora is expired.
什么是hashCode?
Qt | 关于容器类的一些总结
基于mobileNet实现狗的品种分类(迁移学习)
Based on mobileNet dog breed classification (migration)
MySQL----多表查询
什么是Nacos?
遍历堆 PAT甲级 1155 堆路径
面试了个阿里P7大佬,他让我见识到什么才是“精通高并发与调优”
aPaaS低代码平台(二) | 快速构建业务模型
【无标题】
Qt | 控件之 QCheckBox
PAT甲级 1078 哈希
Qt | 鼠标事件和滚轮事件 QMouseEvent、QWheelEvent
Qt | 控件之 QComboBox
mysql 自动添加创建时间、更新时间
【Frequency Domain Analysis】Spectral leakage, frequency resolution, picket fence effect
什么是Knife4j?