当前位置:网站首页>MySQL相关知识
MySQL相关知识
2022-08-01 21:25:00 【【异度空间】】
MySQL相关知识
数据库引擎
- 查看数据库引擎
show engines;
从以上图中可以知道,InnoDB数据库支持事务、行级锁、外键、savepoint
- 修改数据库引擎
说明:在配置文件的mysqld模块下面添加default-storage-engine=INNODB
重启数据库服务后,查看引擎信息,看是否默认引擎修改成功
数据库导入导出
数据库导出
说明:dbname是需要导出的数据库名字
# 登录mysql所在服务器进行本地导出
mysqldump -uroot -p111111 dbname >dbname.db.sql
# 导出远程的mysql数据库到到本地的主机上
mysqldump -uroot -p111111 -h 192.168.72.201 test >test.db.sql
- 数据库导入
# 登录mysql所在服务器进行本地导入
mysql -uroot -p111111 dbname <dbname.db.sql
# 从本地导入,将器导入到远程指定的数据库中
mysql -uroot -p111111 -h 192.168.72.201 test <test.db.sql
慢查询相关
- 查看慢查询信息
show variables like "%slow%";
- 开启慢查询
set global slow_query_log=on;
MySQL数据库密码忘记处理方法
在mysqld模块下面添加skip-grant-tables
sed -i '1a skip-grant-tables' /etc/my.cnf
重启数据库服务,之后可以通过mysql命令免密码登录
修改用户的密码
# 修改密码 update mysql.user set password=password('123456') where user='root'; # 查询 select host,user,password from mysql.user;
删除mysqld模块下面添加skip-grant-tables字段,重启数据库服务,用新密码登录
# 删除 skip-grant-tables 字段 sed -i '2d' /etc/my.cnf # 重启mysql数据库服务 systemctl restart mariadb # 使用新密码登录 mysql -uroot -p123456
边栏推荐
- Classification interface, Taobao classification details API
- Appendix A printf, varargs and stdarg A.3 stdarg.h ANSI version of varargs.h
- HCIP---企业网的架构
- C Pitfalls and Defects Chapter 7 Portability Defects 7.9 Case Conversion
- WEB 渗透之端口协议
- 如何优雅的性能调优,分享一线大佬性能调优的心路历程
- R语言进行相关的操作
- Transplant MQTT source code to STM32F407 development board
- 正则表达式
- 位运算简介
猜你喜欢
随机推荐
Transformer学习
PyTorch笔记 - Attention Is All You Need (2)
测试的意义并不是能找到全部的缺陷
2022牛客多校联赛第五场 题解
【中文树库标记---CTB】
Appendix A printf, varargs and stdarg a. 2 use varargs. H to realize the variable argument list
[Chinese tree tags - CTB]
移植MQTT源码到STM32F407开发板上
C陷阱与缺陷 第7章 可移植性缺陷 7.11 可移植性问题的一个例子
C Expert Programming Preface
如何优雅的性能调优,分享一线大佬性能调优的心路历程
Pytest: begin to use
对C语言结构体内存对齐的理解
数据库练习
C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
An online JVM FullGC made it impossible to sleep all night and completely crashed~
Jmeter combat | Repeated and concurrently grabbing red envelopes with the same user
ISC2022 HackingClub white hat summit countdown 1 day!Most comprehensive agenda formally announced!Yuan universe, wonderful!
附录A printf、varargs与stdarg A.3 stdarg.h ANSI版的varargs.h
C专家编程 第1章 C:穿越时空的迷雾 1.5 今日之ANSI C