当前位置:网站首页>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
边栏推荐
猜你喜欢
Unity 渲染流水线
Desthiobiotin-PEG4-Acid|脱硫生物素-PEG4-酸| 供应商和制造商
I can't hide it, I want to expose the bad things about cloud native
多线程进阶(锁策略,自旋+CAS,Synchronized,JUC,信号量)
测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
原力计划微服务实战|集中配置中心Config非对称加密与安全管理
MongoDB-CUD没有R
用于标记蛋白质和抗体的Biotin-LC-Sulfo-NHS|CAS:191671-46-2
Biotin-PEG4-DADPS-Picolyl-azide(CAS:2599839-59-3)生物素试剂
网络协议04 - 物理层和数据链路层
随机推荐
Jenkins一些常见问题
瀑布流(自定义布局实现)
Mastering JESD204B (3) – Debugging of AD6676
js advanced study notes (detailed)
IO进程线程->文件IO->day2
【无标题】
05-Theos
PC DBCO-PEG3-Biotin|PC-生物素-PEG3-DBCO可用于使用无铜点击化学
矩阵键盘
事件传递和响应者链条
GNNLab:基于空间共享思想设计的新型 GNN 系统
flask项目快速搭建部署gunicorn+supervisor
Network Protocol 04 - Physical and Data Link Layers
阿里京东“喜提”国电投,顶流互联网和能源大厂为何合作?
THREEJS导入外部OBJ+MTL后内存优化
Rapidly develop GraphScope graph analysis applications
Vineyard: An open source distributed in-memory data management framework
基于STM32F103的消防系统之驱动电机风扇
测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)
图扑软件携手华为云再创合作共赢新局面