当前位置:网站首页>MySQL common commands and mysqldump backup
MySQL common commands and mysqldump backup
2022-07-30 07:41:00 【Silent】
I. Character set
1. Create database with default character set
create database if not exists databaseName default charset utf8 collate utf8_general_ci;
2.Character set default configuration
[client]default-character-set=utf8/*[mysqld]*/character-set-server=utf8
3. View Table Character Set
show create table tableName;
4. Modify a single table character set
ALTER TABLE `table` DEFAULT CHARACTER SET utf8;
5. Modify the table field record character set (the table has inserted data)
alter table `tablename` convert to character set utf8;
6. Create table set character set
create table user(id int not null auto_increment,userName varchar(200) not null,password varchar(200) not null,age int,primary key(id))ENGINE=MyISAM auto_increment=1 default charset=utf8;
Second, database connection and backup
1.mysql client cannot connect remotely
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
2. Backup command
Format: mysqldump -h hostname -P port -u username -p password --database database name > filename.sql
mysqldump -h 192.168.1.1 -p 3306 -uroot -ppassword --databases mydb> /data/backup/mydb.sql
3. Backup database structure, not data
mysqldump --opt -d database name -u root -p > xxx.sql
4. Export data does not export structure
mysqldump -t database name (table name) -uroot -p > xxx.sql
5. Export the structure of a specific table
mysqldump -uroot -p -B database name --table table name > xxx.sql
6. Import data
#mysql database name < file name#source /tmp/xxx.sql
边栏推荐
- 基于THREEJS场景中模型局部辉光效果
- Shortcut keys commonly used in the use of Word
- 测试开发工程师成长日记015 - 最强20道测试面试题
- 图扑数字孪生北京故宫,推进旅游业元宇宙进程
- 二、1稀疏sparsearray数组
- com.alibaba.datax.common.exception.DataXException: Code:[ESWriter-03]
- Rapidly develop GraphScope graph analysis applications
- C 语言之学生管理系统-多文件编程
- 测试开发工程师成长日记017 - bug的生命周期
- Cas 80750-24-9,去硫代生物素 N-羟基琥珀酰亚胺,淡黄色固体
猜你喜欢
Shortcut keys commonly used in the use of Word
基于 JupyterLab 插件在 GraphScope 中交互式构图
Graph analysis like NetworkX with GraphScope
单片机第一步
Network Protocol 04 - Physical and Data Link Layers
掌握JESD204B(三)–AD6676的调试
OP tokens and non-transferable NFTs work to build a new digital democracy
【Exhibition of some projects】
A New Paradigm for Distributed Deep Learning Programming: Global Tensor
图扑数字孪生煤矿开采系统,打造采煤“硬实力”
随机推荐
Biotin-PEG4-SS-Alkyne_1260247-54-8_生物素-PEG4-SS-炔烃
GAIA-IR:GraphScope 上的并行化图查询引擎
一种新的DNA生物素系统Biotin LC hydrazide|CAS:109276-34-8|(+)-生物素酰胺基己酸肼
测开基础知识02
Unity 渲染流水线
Cas 80750-24-9,去硫代生物素 N-羟基琥珀酰亚胺,淡黄色固体
多线程基础(概念,创建,中断)
Selenium01
JSP自定义标签
Devops基本概念和原理
libgrape-lite on GPUs:GPU助力加速图分析任务
力扣题解7.27
PC DBCO-PEG3-Biotin|PC-生物素-PEG3-DBCO可用于使用无铜点击化学
二、1稀疏sparsearray数组
测试开发工程师成长日记016 - 关于提测的那些事
网络协议01 - 基础概念
【JVM】线上应用故障排查
瀑布流(自定义布局实现)
掌握JESD204B(二)–AD6676的调试
C#最优二叉树----哈夫曼树