mysql 学习---->修改表的字符集格式

  1. 1.导出与导入表(以修改表的字符集格式)  
  2. abc@ubuntu:~/Downloads$ mysqldump -uroot -p(密码) --default-character-set=gbk -d test1>test1.sql;  
  3. abc@ubuntu:~/Downloads$ mysqldump -uroot -p(密码) --quick --no-create-info --extended-insert --default-character-set=latin1 --no-create-info  test1>testData.sql;  
  4. abc@ubuntu:~/Downloads$ mysql -uroot -p(密码)  
  5. mysql> create database test2 default charset gbk;  
  6.   
  7. mysql> Ctrl-C -- exit!  
  8. Aborted  
  9. abc@ubuntu:~/Downloads$ mysql -uroot -p(密码) test2<test1.sql;  
  10. abc@ubuntu:~/Downloads$ mysql -uroot -p(密码) test2<testData.sql;  
  11. abc@ubuntu:~/Downloads$ mysql -uroot -p(密码)  
  12.   
  13. mysql> show create table t_test \G;  
  14. *************************** 1. row ***************************  
  15.        Table: t_test  
  16. Create TableCREATE TABLE `t_test` (  
  17.   `d` date DEFAULT NULL,  
  18.   `t` time DEFAULT NULL,  
  19.   `dt` datetime DEFAULT NULL  
  20. ) ENGINE=InnoDB DEFAULT CHARSET=utf8  
  21.   
  22. ERROR:   
  23. No query specified  
  24.   
  25. mysql> use test2;  
  26. Reading table information for completion of table and column names  
  27. You can turn off this feature to get a quicker startup with -A  
  28.   
  29. Database changed  
  30. mysql> show create table t_test \G;  
  31. *************************** 1. row ***************************  
  32.        Table: t_test  
  33. Create TableCREATE TABLE `t_test` (  
  34.   `d` date DEFAULT NULL,  
  35.   `t` time DEFAULT NULL,  
  36.   `dt` datetime DEFAULT NULL  
  37. ) ENGINE=InnoDB DEFAULT CHARSET=utf8    
  38.   
  39. ERROR:   
  40. No query specified  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值