当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
The Force Plan Microservices | Centralized Configuration Center Config Asymmetric Encryption and Security Management
图扑数字孪生北京故宫,推进旅游业元宇宙进程
OP tokens and non-transferable NFTs work to build a new digital democracy
libgrape-lite: 提供 GraphScope 的图分析能力
About memcache kernel, so one of the most popular
Biotin-PEG4-SS-Alkyne_1260247-54-8_生物素-PEG4-SS-炔烃
MongoDB-查询
IO进程线程->标准IO->day1
基于STM32F103的消防系统之火焰传感器
不依赖框架的文件下载
多线程基础(概念,创建,中断)
DADPS-生物素-炔基_CAS:2241685-22-1试剂反应原理
测开基础知识01
多线程基础(多线程内存,安全,通信,线程池和阻塞队列)
GAIA-IR: Parallelized Graph Query Engine on GraphScope
GNNLab:基于空间共享思想设计的新型 GNN 系统
测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
D-Desthiobiotin Amine_D-脱硫生物素-胺相关的产品性质
Shortcut keys commonly used in the use of Word
rsync使用方法之坑