mysql数据库基础知识总结

行云流水
2022-07-23 / 0 评论 / 151 阅读 / 正在检测是否收录...

概述

在centos系统下的默认安装目录结构

目录说明
/usr/bin客户端程序和脚本
/usr/sbinmysqld服务器
/var/lib/mysql日志文件,数据库
/usr/share/doc/packages文档
/usr/include/mysql包含(头)文件
/usr/lib/mysql数据
/usr/share/mysql错误消息和字符集文件
/usr/share/sql-bench基准程序

主从复制

常用语句

# 查询一个数据库有多少张数据表;
select count(*) TABLES,table_schema from information_schema.TABLES where table_schema = 'ultrax' group by table_schema;

# 查看某张表的字段信息;
mysql> desc pre_common_connect_guest;

# 查看mysql默认引擎
show variables like '%storage_engine%';

# 列出某数据库表名中包含某字段的表
select table_name from information_schema.tables where table_schema='wpc' and table_type='base table' and table_name like '%_data';

锁表问题

# mysql查看表的状态
show OPEN TABLES where In_use > 0;

# 查看锁表进程
mysql> show processlist;
mysql> kill  112498;  #进程ID

重置密码

# 无密码启动
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables >/dev/null 2>&1 &
update user set password = Password('123456') where User = 'root';
flush privileges;

评论 (0)

取消
只有登录/注册用户才可评论