目录
?第一弹:将数据库(database)导出
?第二弹:将数据库(database)导入
?第三弹:将数据库表(table)导出
?第四弹:将数据库(table)导入
?第一弹:将数据库(database)导出
- mysqldump -u用户名 -p密码 数据库名 > 要导出到的路径(.sql文件)
C:\Users\蒋明辉>mysqldump -uroot -p1234 abc > e:\abc.sql
?回车出现:mysqldump: [Warning] Using a password on the command line interface can be insecure.代表成功了
?第二弹:将数据库(database)导入
- mysql -u用户名 -p密码
- 回车出现一下代码代表登录成功?
C:\Users\蒋明辉>mysql -uroot -p1234
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 68
Server version: 5.7.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> create database abc;
mysql> use abc;
- ?开始导入数据库(source 要导入的数据库路径)
mysql> source e:\abc.sql
?第三弹:将数据库表(table)导出
- mysqldump -u用户名 -p密码 数据库名 表名 > 要导出的路径(.sql)文件
C:\Users\蒋明辉> mysqldump -uroot -p1234 jmh jmh > e:\jmh.sql
??回车出现:mysqldump: [Warning] Using a password on the command line interface can be insecure.代表成功了
第四弹:将数据库(table)导入
-
?mysql -u用户名 -p密码 -
回车出现一下代码代表登录成功?
C:\Users\蒋明辉>mysql -uroot -p1234
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 68
Server version: 5.7.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> use jmh;
mysql> source e:\jmh.sql
|