380

mysql数据库导入导出

 6 years ago
source link: https://www.linuxprobe.com/mysql-import-export.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
1.数据库导入
mysql -uroot -p123456 --default-character-set=utf8 test123< test123.sql
2.数据库导出
  • 导出整个数据库
mysqldump -uroot -p123456 test123> test123.sql
  • 导出数据库单表
mysqldump -uroot -p123456 test123log> test123_log.sql
  • 导出数据库表结构
mysqldump -uroot -p123456 -d --add-drop-table test123> test123.sql

-d 导出空表

--add-drop-table 每个数据表创建之前添加drop数据表语句
3.问题记录

mysqldump在命令行导出时,如果输入密码,提示如下警告信息(已执行成功,只是会提示警告信息)

Warning: Using a password on the command line interface can be insecure.
3.1.修复方法
  • 在命令行导出时,手动输入密码
  • 在/etc/mysql/my.cnf文件最后追加
[mysqldump]
user=user_name
password=password

本文原创地址:https://www.linuxprobe.com/mysql-import-export.html

作者:倪家兴,审核员:暂无


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK