热搜词
发表于 2017-4-11 16:37:34 | 显示全部楼层 |阅读模式

一、准备.sql文件

二、在命令行下登录到MySQL数据库下,创建数据库。


  1. nii@mmch:~/lanqq/code$ mysql -uroot -p  //登录到数据库
  2. Enter password:
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 2
  5. Server version: 5.6.25-0ubuntu0.15.04.1 (Ubuntu)

  6. Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.

  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  11. mysql> CREATE DATABASE test_db;  //创建数据库表test_db
  12. Query OK, 1 row affected (0.42 sec)

  13. mysql> USE test_db;   //默认数据库更改为test_db
  14. Database changed
  15. mysql> source /home/nii/code/qq.sql;  //导入qq.sql文件
  16. Query OK, 0 rows affected (0.32 sec)

  17. Query OK, 0 rows affected (0.09 sec)

  18. Query OK, 0 rows affected (0.09 sec)

  19. Query OK, 0 rows affected (0.12 sec)

  20. Query OK, 0 rows affected (0.09 sec)

  21. Query OK, 0 rows affected (0.02 sec)  //导入成功
复制代码

三、查看数据库是否导入成功。

全部评论0
回复
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|管理员之家 ( 苏ICP备2023053177号-2 )

GMT+8, 2024-11-22 19:38 , Processed in 0.257817 second(s), 26 queries .

Powered by Discuz! X3.5

Cpoyright © 2001-2024 Discuz! Team